-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: impr dockerfile build speed; use entrypoint #195
base: stable
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,35 @@ | ||
# FIXME use alpine | ||
FROM node:14 | ||
|
||
RUN mkdir -p /usr/app/src \ | ||
&& mkdir -p /usr/app/media \ | ||
&& mkdir -p /usr/app/scripts | ||
&& mkdir -p /usr/app/scripts \ | ||
&& apt-get update \ | ||
&& apt-get install netcat -y | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe @serge1peshcoff mentioned that we do not need this anymore, and we could also remove the wait script |
||
|
||
RUN apt-get update | ||
RUN apt-get install netcat -y | ||
WORKDIR /usr/app/src | ||
|
||
COPY ./docker/core/bootstrap.sh /usr/app/scripts/bootstrap.sh | ||
COPY ./docker/core/wait.sh /usr/app/scripts/wait.sh | ||
COPY . /usr/app/src | ||
RUN mkdir /usr/app/src/state | ||
COPY package.json /usr/app/src | ||
|
||
RUN chown -R node:node /usr/app | ||
|
||
WORKDIR /usr/app/src | ||
|
||
USER node | ||
|
||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global | ||
ENV PATH="/home/node/.npm-global/bin:${PATH}" | ||
|
||
RUN npm install -g --loglevel warn nodemon bunyan && npm cache clean --force | ||
RUN npm install --loglevel warn | ||
# FIXME no need for nodemon | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep nodemon for dev, but we can remove it in prod I guess There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes as mentioned above, there's the need for a discussion. Now I am trying to close as much as possible :D |
||
RUN npm install -g --loglevel warn nodemon bunyan \ | ||
&& npm cache clean --force \ | ||
&& npm install --loglevel warn | ||
|
||
COPY --chown=node:node ./docker/core/bootstrap.sh /usr/app/scripts/bootstrap.sh | ||
COPY --chown=node:node ./docker/core/wait.sh /usr/app/scripts/wait.sh | ||
COPY --chown=node:node . /usr/app/src | ||
RUN mkdir /usr/app/src/state | ||
|
||
|
||
CMD sh /usr/app/scripts/bootstrap.sh && nodemon -e "js,json" lib/run.js | ||
ENTRYPOINT [ "/usr/app/scripts/bootstrap.sh" ] | ||
CMD ["nodemon -e 'js,json' lib/run.js"] | ||
|
||
EXPOSE 8084 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would alpine be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not better but more "like a pro" (if you use lightweight containers is better, less footprint. Of course this is most important in systems we do not have, like kubernetes, but we want to be following good practices so it's good to mark this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, then I would suggest making line 2 into
FROM node:14.15.1-alpine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I didn't do it myself because we don't need that level of lightweight-ness yet, and I therefore didn't want to risk breaking image building et al ('larger' image means that we have more/different tools, e.g. we do not use
apt-get
butapk
, and i didn't want to spend time on that)