40 lines
879 B
YAML
40 lines
879 B
YAML
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}
|
|
ports:
|
|
- 1234:1234
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?sslmode=disable
|
|
|
|
swagger:
|
|
image: swaggerapi/swagger-ui
|
|
ports:
|
|
- 1235:8080
|
|
environment:
|
|
- SWAGGER_JSON=/openapi.yaml
|
|
volumes:
|
|
- ./api/openapi.yaml:/openapi.yaml:ro
|