This repository has been archived on 2024-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
golang-rest-example/docker-compose.yaml
2024-02-02 15:39:13 +01:00

43 lines
890 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
app:
build:
dockerfile: Dockerfile
context: .
target: dev
args:
- GO_VERSION=${GO_VERSION}
ports:
- 1234:1234
volumes:
- .:/app
depends_on:
db:
condition: service_healthy
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?sslmode=disable
- PORT=1234
swagger:
image: swaggerapi/swagger-ui
ports:
- 1235:8080
environment:
- SWAGGER_JSON=/api/openapi.yaml
volumes:
- ./api:/api
depends_on:
- app