Add Docker support and docker-compose orchestration

Multi-stage Dockerfile for the Go API, plus a docker-compose.yml that
runs postgres + backend + both frontends together for local
full-stack dev (frontends built from the sibling repo directories).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 00:01:10 +03:30
parent 2823fb45f5
commit fda1b130ff
4 changed files with 105 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
name: dating-app
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
POSTGRES_DB: ${DB_NAME:-dating_app}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-dating_app}"]
interval: 5s
timeout: 5s
retries: 10
backend:
build:
context: .
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
env_file:
- .env
environment:
# داخل شبکه‌ی داکر، بک‌اند باید با نام سرویس به دیتابیس وصل بشه نه localhost
DB_HOST: postgres
ports:
- "${APP_PORT:-8080}:8080"
volumes:
- backend_uploads:/app/uploads
web:
build:
context: ../../../frontend/dating-app-web
args:
# این آدرس توی مرورگر کاربر استفاده می‌شه، پس باید از بیرون قابل‌دسترس باشه
# (نه آدرس داخلی شبکه‌ی داکر مثل http://backend:8080)
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:8080/api/v1}
restart: unless-stopped
depends_on:
- backend
ports:
- "${WEB_PORT:-3000}:3000"
admin:
build:
context: ../../../frontend/dating-app-admin
args:
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:8080/api/v1}
restart: unless-stopped
depends_on:
- backend
ports:
- "${ADMIN_PORT:-3001}:3000"
volumes:
postgres_data:
backend_uploads: