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
ports:
- "${DB_MYSQL_PORT}:3306"
networks:
- node-network
postgres:
image: postgres:10
restart: always
ports:
- "${DB_POSTGRES_PORT}:5432"
networks:
- node-network
command: postgres -c wal_level=logical
environment:
POSTGRES_USER: ${DB_USER}
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