# Using Dockerfile.backend (context: ./backend)
docker compose build backend
# Or manually:
docker build -t anjungan-backend -f Dockerfile.backend ./backendThe backend Dockerfile:
- Build stage —
golang:1.25-alpinecompiles with-ldflags="-s -w"for smaller binary - Runtime stage —
alpine:3.20includesca-certificates,openssh-client,docker-cli,curl - Runs as non-root user
anjungan(UID 1000)
# Using Dockerfile.frontend (context: project root)
docker compose build frontend
# Or manually:
docker build -t anjungan-frontend -f Dockerfile.frontend .The frontend Dockerfile:
- Build stage —
node:22-alpinerunsnpm install --legacy-peer-depsthennpm run build - Runtime stage —
nginx:1.27-alpineserves the static build output - Nginx config: SPA fallback (
try_files $uri /index.html), immutable cache for/_app/assets, proxy/api/*to backend
Images are pushed to GitHub Container Registry (GHCR) on ghcr.io/edsuwarna/anjungan-*.
| Tag Pattern | When | Example |
|---|---|---|
release-latest |
Tag push v* |
ghcr.io/edsuwarna/anjungan-backend:release-latest |
v0.3.0 |
Tag push v* |
ghcr.io/edsuwarna/anjungan-backend:v0.3.0 |
main-latest |
Push to main |
ghcr.io/edsuwarna/anjungan-frontend:main-latest |
main-{sha} |
Push to main |
ghcr.io/edsuwarna/anjungan-frontend:main-a1b2c3d |
The workflow .github/workflows/docker-build-push.yml:
- On push to
main— builds both images, pushes withmain-latest+main-{sha}tags - On tag push
v*— builds both images, pushes withrelease-latest+v{version}tags
No additional secrets needed — GITHUB_TOKEN is provided automatically by GitHub Actions with packages: write permission.
# Pull latest code
git pull origin main
# Rebuild and restart
docker compose build
docker compose up -d --force-recreate
# Verify
docker compose ps
docker compose logs --tail=20 backend