Permalink
Browse files

prod mode setup

  • Loading branch information...
hoatle committed Jul 6, 2017
1 parent 7876be5 commit a710fda1e9602e4f5e558198c6a3206affb8976e
Showing with 63 additions and 0 deletions.
  1. +1 −0 .env-prod
  2. +29 −0 Dockerfile
  3. +25 −0 docker-compose.prod.yml
  4. +5 −0 process.yml
  5. +3 −0 run-prod.sh
@@ -0,0 +1 @@
# specific environtment variables for prod mode
@@ -0,0 +1,29 @@
FROM node:8.1.3-alpine
LABEL authors="hoatle <hoatle@teracy.com>"
RUN mkdir -p /opt/app
ENV TERM=xterm APP=/opt/app
# add more arguments from CI to the image so that `$ env` should reveal more info
ARG CI_BUILD_ID
ARG CI_BUILD_REF
ARG CI_REGISTRY_IMAGE
ARG CI_BUILD_TIME
ARG NODE_ENV
ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \
CI_BUILD_TIME=$CI_BUILD_TIME NODE_ENV=$NODE_ENV
WORKDIR $APP
ADD package.json yarn.lock $APP/
RUN yarn install && \
yarn global add pm2 && \
yarn cache clean
ADD . $APP
CMD ["sh", "run-prod.sh"]
@@ -0,0 +1,25 @@
version: '3'
services:
prod:
build:
context: .
dockerfile: Dockerfile
args:
CI_BUILD_ID: ${CI_BUILD_ID}
CI_BUILD_REF: ${CI_BUILD_REF}
CI_BUILD_TIME: ${CI_BUILD_TIME}
CI_REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE}
NODE_ENV: production
image: ${DOCKER_IMAGE_PROD:-acme101/nodejs-hello-world:develop}
environment:
PORT: 8080
VIRTUAL_HOST: nodejs.teracy.dev, ~^nodejs\..*\.xip\.io
HTTPS_METHOD: noredirect # support both http and https
env_file:
- .env-common
- .env-prod
ports:
- "8080"
network_mode: bridge
@@ -0,0 +1,5 @@
apps:
- script : './app.js'
name : 'nodejs-hello-world'
exec_mode: 'cluster'
instances: 1
@@ -0,0 +1,3 @@
#!/bin/bash
pm2-docker --raw process.yml

0 comments on commit a710fda

Please sign in to comment.