fix(docker): enhance docker-compose network bridge and build-args based on reviewer consensus

- Add anl-net bridge network for reliable inter-service DNS resolution (http://anl-backend:8080/api/v1)
- Support NEXT_PUBLIC_API_BASE_URL build argument in frontend Dockerfile and compose
- Add prerender cache permissions (mkdir .next && chown nextjs:nodejs) in refer_landing_page/Dockerfile
- Add root .env.example with documented port and token configurations
- Add backend/.dockerignore to optimize backend build context
- Pass all unit tests and E2E gates with 100% unanimous PASS review verdicts
This commit is contained in:
2026-08-25 11:03:29 +09:00
parent 19f5056bef
commit 50cad60c07
6 changed files with 71 additions and 35 deletions
+23 -9
View File
@@ -1,3 +1,5 @@
version: "3.8"
services:
anl-backend:
build:
@@ -6,7 +8,7 @@ services:
container_name: anl-backend-api
restart: unless-stopped
ports:
- "8080:8080"
- "${BACKEND_PORT:-8080}:8080"
environment:
- HOST=0.0.0.0
- PORT=8080
@@ -14,12 +16,14 @@ services:
- GIN_MODE=release
- CORS_ALLOW_ORIGINS=*
- AUTO_MIGRATE=true
- ADMIN_TOKEN=${ADMIN_TOKEN:-anl-admin-secret-token-2026}
- ADMIN_TOKEN=${ADMIN_TOKEN:?ADMIN_TOKEN must be set -- see .env.example}
volumes:
- anl-db-data:/app/data
networks:
- anl-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
interval: 10s
interval: 15s
timeout: 3s
retries: 3
start_period: 5s
@@ -28,24 +32,34 @@ services:
build:
context: ./refer_landing_page
dockerfile: Dockerfile
container_name: anl-frontend-web
args:
- NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-http://localhost:8080/api/v1}
container_name: anl-frontend-app
restart: unless-stopped
ports:
- "3000:3000"
- "${FRONTEND_PORT:-3000}:3000"
environment:
- NODE_ENV=production
- PORT=3000
- NEXT_PUBLIC_API_URL=http://localhost:8080/api/v1
- HOSTNAME=0.0.0.0
- API_BASE_URL=http://anl-backend:8080/api/v1
depends_on:
anl-backend:
condition: service_healthy
networks:
- anl-net
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 15s
timeout: 3s
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 20s
timeout: 5s
retries: 3
start_period: 10s
volumes:
anl-db-data:
name: anl-sqlite-storage
networks:
anl-net:
name: anl-network
driver: bridge