Created
November 22, 2019 11:38
-
-
Save redecs/fa50b3d7f5ab44740af81c69856e0c9b to your computer and use it in GitHub Desktop.
Docker entrypoint example for node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NODE_ENV=${NODE_ENV:-production} | |
set -eux | |
if [ "$NODE_ENV" != 'production' ]; then | |
#yarn install --pure-lockfile | |
#npm install | |
# see https://docs.npmjs.com/cli/ci | |
npm ci | |
fi | |
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:${NODE_VERSION}-alpine | |
WORKDIR /app | |
ENV PATH /app/node_modules/.bin:$PATH | |
#COPY package.json yarn.lock ./ | |
COPY package*.json ./ | |
#RUN yarn install --pure-lockfile | |
RUN npm ci | |
COPY . ./ | |
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint | |
RUN chmod +x /usr/local/bin/docker-entrypoint | |
ENTRYPOINT ["docker-entrypoint"] | |
#CMD ["yarn", "start"] | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment