Skip to content

Commit

Permalink
Add Postgres container
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantGryczan committed Feb 11, 2024
1 parent 0f95a90 commit 578d8ed
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_PASSWORD=password
31 changes: 31 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,40 @@ services:
args:
BIN_NAME: file_server
restart: on-failure
depends_on:
db:
condition: service_healthy

api_server:
build:
args:
BIN_NAME: api_server
restart: on-failure
depends_on:
db:
condition: service_healthy

db:
image: postgres:16-alpine
restart: on-failure
user: postgres
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
secrets:
- db-password
expose:
- 5432
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5

volumes:
db-data:

secrets:
db-password:
environment: DB_PASSWORD

0 comments on commit 578d8ed

Please sign in to comment.