Created
April 15, 2022 09:16
-
-
Save Develp10/56e09cccf27cbae38098d4a9e318dc57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
postgres: | |
container_name: postgres | |
image: postgres:14.2 | |
environment: | |
POSTGRES_USER: ${DB_USER} | |
POSTGRES_PASSWORD: ${DB_PASS} | |
POSTGRES_DB: ${DB_NAME} | |
ports: | |
- "5432:5432" | |
volumes: | |
- dbdata:/var/lib/postgresql/data | |
healthcheck: | |
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
go: | |
container_name: go | |
build: | |
context: . | |
depends_on: | |
postgres: | |
condition: service_healthy # waiting until heathcheck of postgres is good | |
ports: | |
- "3000:3000" | |
volumes: | |
dbdata: # persist database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment