forked from LondheShubham153/devboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (50 loc) · 1.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
54 lines (50 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# DevBoard (advanced) — UI + Go backend + Postgres. That's the whole stack.
#
# browser ──▶ frontend (vite preview :4173) ──/api──▶ backend (Go) ──▶ postgres
#
# Every configurable value lives in .env — Compose loads it automatically and
# fills in the ${...} placeholders below. Edit .env, not this file, to change
# credentials or ports. This way learners can see in one place exactly which
# variables get injected into the db and the backend.
#
# Bring it up: docker compose up --build
# Then open: http://localhost:8080 (FRONTEND_HOST_PORT)
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
- ./init/postgres:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "${POSTGRES_HOST_PORT}:5432"
backend:
# build = local; image = the tag CI pushes and CD pulls (IMAGE_TAG, else latest).
build: ./backend
image: trainwithshubham/devboard-backend:${IMAGE_TAG:-latest}
environment:
PORT: "${BACKEND_PORT}"
# Built from the Postgres vars above so the credentials live in one place.
POSTGRES_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable"
depends_on:
postgres:
condition: service_healthy
ports:
- "${BACKEND_HOST_PORT}:${BACKEND_PORT}" # host:container — direct curl/debug; the UI uses the gateway
frontend:
build: ./frontend
image: trainwithshubham/devboard-frontend:${IMAGE_TAG:-latest}
depends_on:
- backend
ports:
- "${FRONTEND_HOST_PORT}:4173" # vite preview serves on 4173 inside the container
volumes:
pgdata: