diff --git a/docker-compose.yml b/docker-compose.yml index 1f13bcf..b1e9787 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,23 @@ -services: +networks: tutorotp: + +volumes: + postgres_data: + +secrets: + postgres_password: + file: ./postgres_password.txt + +services: + web: build: . image: pinlin/tutorotp:latest + networks: + - tutorotp environment: - NODE_ENV=production - PORT=3000 - - PGHOST= + - PGHOST=postgres - PGPORT=5432 - PGUSER=tutorotp - PGPASSWORD= @@ -15,4 +27,22 @@ services: - CLIENT_ID= - CLIENT_SECRET= - COOKIE_SECRET= + ports: + - "3000:3000" + depends_on: + - postgres restart: always + + postgres: + image: postgres:16.4-alpine + restart: always + networks: + - tutorotp + volumes: + - postgres_data:/var/lib/postgresql/data/ + secrets: + - postgres_password + environment: + POSTGRES_DB: tutorotp + POSTGRES_USER: tutorotp + POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password