Last active
May 10, 2019 20:06
-
-
Save firebuggirl/bfc64f2f1c6ab742f75dca87ca2ec26c to your computer and use it in GitHub Desktop.
Revisions
-
firebuggirl revised this gist
May 10, 2019 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ # slim does not work w/tini # FROM node:10-slim as prod FROM node:10.15-alpine as prod ENV NODE_ENV=production -
firebuggirl created this gist
May 8, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ FROM node:10-slim as prod ENV NODE_ENV=production EXPOSE 3000 RUN apk add --no-cache tini WORKDIR WORKDIR /app COPY package*.json ./ RUN npm install --only=production && npm cache clean --force COPY . . # ..use this in prod if want to prevent images from building as a result of failed tests # RUN npm test ENTRYPOINT ["/sbin/tini", "--"] CMD ["node", "./bin/www"] FROM prod as dev ENV NODE_ENV=development RUN npm install --only=development CMD ["../node_modules/nodemon/bin/nodemon.js", "./bin/www", "--inspect=0.0.0.0:9229"] FROM dev as test ENV NODE_ENV=development CMD ["npm", "test"] # Build + run prod: # docker build -t multistage --target prod . && docker run --init -p 3000:3000 multistage # Build + run dev: # docker build -t multistage:dev --target dev . && docker run --init -p 3000:3000 multistage:dev # need the tini `--init` process for `ctrl + c`..stopping container # Build + run test: # docker build -t multistage:test --target test . && docker run --init multistage:test