Fix Docker configuration for deployment

- Update backend Dockerfile to use Rust 1.85 (edition 2024 support)
- Add Aliyun mirrors for Alpine packages
- Add rsproxy.cn mirror for cargo crates
- Enable static OpenSSL linking
- Fix frontend Dockerfile to use NEXT_PUBLIC_API_BASE
- Add mkdir -p public to ensure public dir exists
- Update docker-compose files to use correct env var names
- Add docker-compose.deploy.yml for production deployment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Michael Dong
2026-02-05 18:35:45 +08:00
parent 86d3a8c419
commit faf9f3abcf
4 changed files with 58 additions and 7 deletions

37
docker-compose.deploy.yml Normal file
View File

@@ -0,0 +1,37 @@
version: "3.8"
services:
backend:
build:
context: ./backend_rust
dockerfile: Dockerfile
container_name: notify-backend
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@host.docker.internal:5432/${POSTGRES_DB:-notify}
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
BASE_URL: ${BASE_URL:-http://localhost}
ports:
- "127.0.0.1:4000:4000"
volumes:
- uploads_data:/app/uploads
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost}
container_name: notify-frontend
restart: unless-stopped
depends_on:
- backend
environment:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost}
ports:
- "127.0.0.1:3001:3000"
volumes:
uploads_data: