71 lines
2 KiB
YAML
71 lines
2 KiB
YAML
|
|
# =============================================================================
|
||
|
|
# go-doc development stack.
|
||
|
|
#
|
||
|
|
# Both services bind-mount the repository so edits are live-synchronised with the
|
||
|
|
# host: the Go backend recompiles through `go run` and Vite serves hot module
|
||
|
|
# replacement. The data directory is mounted as well, so the flat-file Markdown
|
||
|
|
# and JSON written by a container is the same file the host tooling reads.
|
||
|
|
# =============================================================================
|
||
|
|
|
||
|
|
name: go-doc
|
||
|
|
|
||
|
|
services:
|
||
|
|
api:
|
||
|
|
build:
|
||
|
|
context: ./backend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
image: go-doc/api:dev
|
||
|
|
container_name: godoc-api
|
||
|
|
command: ["go", "run", "main.go", "-addr", "0.0.0.0:8080"]
|
||
|
|
environment:
|
||
|
|
GO_DOC_DATA_DIR: /app/data
|
||
|
|
GO_DOC_LOG_FORMAT: json
|
||
|
|
GO_DOC_LOG_LEVEL: info
|
||
|
|
GO_LOOSE_BASE_URL: https://auth-dev.urpi.be
|
||
|
|
GO_LOOSE_CLIENT_ID: go-doc
|
||
|
|
GO_LOOSE_CLIENT_SECRET: local-dev-secret
|
||
|
|
GO_LOOSE_REDIRECT_URL: https://doc-dev.urpi.be/auth/callback
|
||
|
|
volumes:
|
||
|
|
- ./backend:/app/backend
|
||
|
|
- ./data:/app/data
|
||
|
|
- api-go-cache:/root/.cache/go-build
|
||
|
|
- api-go-mod:/go/pkg/mod
|
||
|
|
ports:
|
||
|
|
- "8080:8080"
|
||
|
|
working_dir: /app/backend
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/api/health"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 3s
|
||
|
|
retries: 12
|
||
|
|
start_period: 20s
|
||
|
|
networks: [godoc]
|
||
|
|
|
||
|
|
frontend:
|
||
|
|
build:
|
||
|
|
context: ./frontend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
image: go-doc/frontend:dev
|
||
|
|
container_name: godoc-frontend
|
||
|
|
command: ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]
|
||
|
|
environment:
|
||
|
|
GO_DOC_BACKEND: http://api:8080
|
||
|
|
volumes:
|
||
|
|
- ./frontend:/app
|
||
|
|
- frontend-node-modules:/app/node_modules
|
||
|
|
ports:
|
||
|
|
- "5173:5173"
|
||
|
|
working_dir: /app
|
||
|
|
depends_on:
|
||
|
|
api:
|
||
|
|
condition: service_healthy
|
||
|
|
networks: [godoc]
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
api-go-cache:
|
||
|
|
api-go-mod:
|
||
|
|
frontend-node-modules:
|
||
|
|
|
||
|
|
networks:
|
||
|
|
godoc:
|
||
|
|
driver: bridge
|