Files
HokmPlay/docker-compose.yml
T
soroush.asadi fde8b93206
CI/CD / CI - API (dotnet build + engine sim) (push) Failing after 1m40s
CI/CD / CI - Web (tsc + next build) (push) Failing after 1m31s
CI/CD / Deploy - local stack (db + server + web) (push) Has been skipped
Fix Docker build/runtime: 0.0.0.0 bind, npm ci, HTTP-mirror fallback
Issues found bringing the stack up locally and fixed:
- Server was loopback-only inside the container (appsettings "Urls=localhost"
  wins over ASPNETCORE_URLS) → published port returned "empty reply". Force the
  bind with command-line args: ENTRYPOINT dotnet Hokm.Server.dll --urls 0.0.0.0:5005.
- Web image: npm install crashed on alpine ("Exit handler never called"); root
  cause was UNABLE_TO_GET_ISSUER_CERT_LOCALLY — the Nexus mirror serves a partial
  chain that Node's CA bundle can't complete. Use npm ci + strict-ssl=false.
- .NET restore hit the same partial chain (NU1301 PartialChain). Both registries
  are now build ARGs (NUGET_INDEX / NPM_REGISTRY) defaulting to the HTTPS mirror
  (CI runner trusts it); local .env overrides to the plain-HTTP Nexus
  (http://171.22.25.73:8081) which has no TLS. NuGet feed is generated inline with
  allowInsecureConnections so .NET 10 accepts the HTTP source.

Verified on local Docker (Postgres-backed): db+server+web all healthy; API + web
reachable from host on 1505/1500; auth → profile (1000 coins) → friend add/accept
(bidirectional) → chat (unread) all 200; rows persisted in Postgres
(Profiles=2, Friends=2, Messages=1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 19:59:27 +03:30

92 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Barg-e Vasat — local/self-hosted stack.
# Ports live in the 15001600 range so this stack can run alongside a manual
# `npm run dev` (:3000) and `dotnet run` (:5005) without colliding.
# web → http://localhost:1500
# api → http://localhost:1505
# db → localhost:1510 (postgres)
# All values come from .env (the deploy job writes it from the ENV_FILE secret).
services:
db:
image: mirror.soroushasadi.com/postgres:16-alpine
container_name: hokm-db
restart: unless-stopped
environment:
POSTGRES_DB: hokm
POSTGRES_USER: hokm
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hokm_dev_pass}
volumes:
- hokm_db_data:/var/lib/postgresql/data
ports:
- "${DB_PORT:-1510}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hokm -d hokm"]
interval: 5s
timeout: 5s
retries: 10
server:
build:
context: ./server
dockerfile: Dockerfile
args:
# Default HTTPS; local .env overrides to the HTTP Nexus IP (PartialChain).
NUGET_INDEX: ${NUGET_INDEX:-https://mirror.soroushasadi.com/repository/nuget-group/index.json}
image: hokm-server:latest
container_name: hokm-server
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
ASPNETCORE_ENVIRONMENT: Production
ASPNETCORE_URLS: http://0.0.0.0:5005
Database__Provider: postgres
ConnectionStrings__Default: "Host=db;Port=5432;Database=hokm;Username=hokm;Password=${POSTGRES_PASSWORD:-hokm_dev_pass}"
Jwt__Key: ${JWT_KEY:?set JWT_KEY in .env}
Jwt__Issuer: ${JWT_ISSUER:-hokm}
Jwt__Audience: ${JWT_AUDIENCE:-hokm-clients}
# Comma-separated origins the browser uses to reach the web app.
Cors__Origins: ${CORS_ORIGINS:-http://localhost:1500}
Zarinpal__MerchantId: ${ZARINPAL_MERCHANT_ID:-299685fb-cadf-4dfc-98e2-d4af5d81528d}
Zarinpal__Sandbox: ${ZARINPAL_SANDBOX:-true}
Zarinpal__CallbackUrl: ${ZARINPAL_CALLBACK_URL:-http://localhost:1505/api/coins/pay/callback}
Zarinpal__ClientReturnUrl: ${ZARINPAL_CLIENT_RETURN_URL:-http://localhost:1500}
ports:
- "${API_PORT:-1505}:5005"
healthcheck:
test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:5005/"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
web:
build:
context: .
dockerfile: Dockerfile
args:
# Baked into the static bundle at build time. Must be the address the
# BROWSER uses to reach the API (host-mapped api port, or LAN IP).
NEXT_PUBLIC_USE_SERVER: "1"
NEXT_PUBLIC_SERVER_URL: ${NEXT_PUBLIC_SERVER_URL:-http://localhost:1505}
# Default HTTPS; local .env overrides to the HTTP Nexus IP (PartialChain).
NPM_REGISTRY: ${NPM_REGISTRY:-https://mirror.soroushasadi.com/repository/npm-group/}
image: hokm-web:latest
container_name: hokm-web
restart: unless-stopped
depends_on:
server:
condition: service_healthy
ports:
- "${WEB_PORT:-1500}:80"
healthcheck:
test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1/"]
interval: 10s
timeout: 5s
retries: 6
start_period: 10s
volumes:
hokm_db_data: