chore: add app container

This commit is contained in:
chenos 2020-12-14 17:06:05 +08:00
parent d45d37cabf
commit a687e1e1e3
3 changed files with 37 additions and 1 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
.env
packages/app/.env

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:12.20.0-stretch
WORKDIR /app
COPY . /app
RUN ls -a
RUN npm config set registry https://registry.npm.taobao.org
RUN npm install
RUN npm run bootstrap
RUN npm run build
# # Install app dependencies
# ENV NPM_CONFIG_LOGLEVEL warn
# RUN yarn install
# # Show current folder structure in logs
RUN ls -a
# CMD [ "npm", "run", "serve" ]

View File

@ -27,13 +27,27 @@ services:
restart: always restart: always
ports: ports:
- "${DB_MYSQL_PORT}:3306" - "${DB_MYSQL_PORT}:3306"
networks:
- node-network
postgres: postgres:
image: postgres:10 image: postgres:10
restart: always restart: always
ports: ports:
- "${DB_POSTGRES_PORT}:5432" - "${DB_POSTGRES_PORT}:5432"
networks:
- node-network
command: postgres -c wal_level=logical command: postgres -c wal_level=logical
environment: environment:
POSTGRES_USER: ${DB_USER} POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_DATABASE} POSTGRES_DB: ${DB_DATABASE}
POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_PASSWORD: ${DB_PASSWORD}
app:
build:
context: .
dockerfile: Dockerfile
command: [ "yarn", "start" ]
ports:
- "${APP_HTTP_PORT}:${APP_HTTP_PORT}"
- "${HTTP_PORT}:${HTTP_PORT}"
networks:
- node-network