File tree Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Expand file tree Collapse file tree 5 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ # specific environtment variables for prod mode
Original file line number Diff line number Diff line change
1
+ FROM node:8.1.3-alpine
2
+
3
+ LABEL authors="hoatle <hoatle@teracy.com>"
4
+
5
+ RUN mkdir -p /opt/app
6
+
7
+ ENV TERM=xterm APP=/opt/app
8
+
9
+ # add more arguments from CI to the image so that `$ env` should reveal more info
10
+ ARG CI_BUILD_ID
11
+ ARG CI_BUILD_REF
12
+ ARG CI_REGISTRY_IMAGE
13
+ ARG CI_BUILD_TIME
14
+ ARG NODE_ENV
15
+
16
+ ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \
17
+ CI_BUILD_TIME=$CI_BUILD_TIME NODE_ENV=$NODE_ENV
18
+
19
+ WORKDIR $APP
20
+
21
+ ADD package.json yarn.lock $APP/
22
+
23
+ RUN yarn install && \
24
+ yarn global add pm2 && \
25
+ yarn cache clean
26
+
27
+ ADD . $APP
28
+
29
+ CMD ["sh" , "run-prod.sh" ]
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+
3
+ services :
4
+
5
+ prod :
6
+ build :
7
+ context : .
8
+ dockerfile : Dockerfile
9
+ args :
10
+ CI_BUILD_ID : ${CI_BUILD_ID}
11
+ CI_BUILD_REF : ${CI_BUILD_REF}
12
+ CI_BUILD_TIME : ${CI_BUILD_TIME}
13
+ CI_REGISTRY_IMAGE : ${CI_REGISTRY_IMAGE}
14
+ NODE_ENV : production
15
+ image : ${DOCKER_IMAGE_PROD:-acme101/nodejs-hello-world:develop}
16
+ environment :
17
+ PORT : 8080
18
+ VIRTUAL_HOST : nodejs.teracy.dev, ~^nodejs\..*\.xip\.io
19
+ HTTPS_METHOD : noredirect # support both http and https
20
+ env_file :
21
+ - .env-common
22
+ - .env-prod
23
+ ports :
24
+ - " 8080"
25
+ network_mode : bridge
Original file line number Diff line number Diff line change
1
+ apps :
2
+ - script : ' ./app.js'
3
+ name : ' nodejs-hello-world'
4
+ exec_mode : ' cluster'
5
+ instances : 1
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ pm2-docker --raw process.yml
You can’t perform that action at this time.
0 commit comments