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
ports:
- 1233:5432
app:
image: golang-rest-example
build:
dockerfile: Dockerfile
context: .
args:
- GO_VERSION=${GO_VERSION}
- 1234:1234
depends_on:
condition: service_healthy
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?sslmode=disable
swagger:
image: swaggerapi/swagger-ui
- 1235:8080
- SWAGGER_JSON=/openapi.yaml
volumes:
- ./api/openapi.yaml:/openapi.yaml:ro