version: "3.9"
services:
db:
image: postgres
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5
app:
build:
dockerfile: Dockerfile
context: .
target: dev
args:
- GO_VERSION=${GO_VERSION}
ports:
- 1234:1234
volumes:
- .:/app
depends_on:
condition: service_healthy
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?sslmode=disable
- PORT=1234
swagger:
image: swaggerapi/swagger-ui
- 1235:8080
- SWAGGER_JSON=/api/openapi.yaml
- ./api:/api
- app