Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
prod mode setup
- Loading branch information
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# specific environtment variables for prod mode |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apps: | ||
- script : './app.js' | ||
name : 'nodejs-hello-world' | ||
exec_mode: 'cluster' | ||
instances: 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
pm2-docker --raw process.yml |