Skip to content

Instantly share code, notes, and snippets.

@Develp10
Created April 15, 2022 09:16
Show Gist options
  • Save Develp10/56e09cccf27cbae38098d4a9e318dc57 to your computer and use it in GitHub Desktop.
Save Develp10/56e09cccf27cbae38098d4a9e318dc57 to your computer and use it in GitHub Desktop.
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