This commit is contained in:
Sergey Yarkov 2022-03-22 23:13:57 +03:00
parent 1093167ed6
commit e1d5421fa2
2 changed files with 5 additions and 7 deletions

View File

@ -27,7 +27,7 @@ application.
## How to deploy ## How to deploy
- 1. Clone this repository `git clone https://github.com/sergeyyarkov/node-docker-example.git .` - 1. Clone this repository `git clone https://github.com/sergeyyarkov/node-docker-example.git .`
- 2. Configure enviroment variables in `docker-compose.yml` if you need to - 2. Configure enviroment variables in `docker-compose.yml` for `postgres` and `nodejs` serivces if you need to
- 3. Build and run application with `docker compose up --build` - 3. Build and run application with `docker compose up --build`
## Requirements ## Requirements

View File

@ -21,9 +21,7 @@ services:
target: production target: production
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- ${PORT}:${PORT} - 4000:4000
env_file:
- .env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- PG_HOST=postgres - PG_HOST=postgres
@ -55,9 +53,9 @@ services:
- ./sql/schema_init.sql:/docker-entrypoint-initdb.d/schema_init.sql - ./sql/schema_init.sql:/docker-entrypoint-initdb.d/schema_init.sql
- ./sql/seed.sql:/docker-entrypoint-initdb.d/seed.sql - ./sql/seed.sql:/docker-entrypoint-initdb.d/seed.sql
environment: environment:
POSTGRES_USER: ${PG_USER} POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${PG_PASSWORD} POSTGRES_PASSWORD: 1234
POSTGRES_DB: ${PG_DB_NAME} POSTGRES_DB: articles
ports: ports:
- 5432:5432 - 5432:5432
networks: networks: