Created
January 5, 2018 01:51
-
-
Save augustovictor/84ea7a2ec7e4f381a6290ba3c05197c7 to your computer and use it in GitHub Desktop.
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 characters
| # ---- Base Node ---- | |
| FROM node:8.9.1-alpine AS base | |
| RUN apk add --no-cache openssl | |
| ENV DOCKERIZE_VERSION v0.6.0 | |
| RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | |
| && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | |
| && rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz | |
| RUN mkdir -p usr/src/app | |
| WORKDIR usr/src/app | |
| # By using arg to set the port we can set it on build | |
| # docker build --build-arg PORT=3000 | |
| # | |
| # | |
| # ---- Dependencies ---- | |
| FROM base AS dependencies | |
| COPY package.json . | |
| RUN npm set progress=false && npm config set depth 0 | |
| RUN npm install --only=production | |
| RUN cp -R node_modules prod_node_modules | |
| RUN npm install | |
| # | |
| # | |
| # ---- Test ---- | |
| FROM dependencies AS test | |
| COPY . . | |
| RUN npm run integration-tests | |
| # | |
| # | |
| # ---- Release ---- | |
| FROM base AS release | |
| COPY --from=dependencies /usr/src/app/prod_node_modules ./node_modules | |
| COPY . . | |
| ARG PORT | |
| ENV PORT=${PORT} | |
| EXPOSE $PORT | |
| # COPY docker-entrypoint.sh / | |
| # RUN chmod 777 docker-entrypoint.sh | |
| # ENTRYPOINT ["/docker-entrypoint.sh"] | |
| CMD dockerize -wait tcp://amb-mysql-db:3306 -timeout 5m npm start | |
| # CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment