feat: 添加生产环境docker-compose配置

This commit is contained in:
2026-05-03 11:12:18 +08:00
parent 4b36913607
commit e71437190b
3 changed files with 81 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
MYSQL_ROOT_PASSWORD=your-secure-password
MYSQL_DATABASE=verification_platform
MYSQL_PORT=3306
REDIS_PORT=6379
APP_PORT=8080
JWT_SECRET=your-jwt-secret-change-me
+1 -1
View File
@@ -1,4 +1,4 @@
package admin
package admin
import (
"time"
+74
View File
@@ -0,0 +1,74 @@
services:
mysql:
image: mysql:8.0
container_name: verify-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root123456}
MYSQL_DATABASE: ${MYSQL_DATABASE:-verification_platform}
MYSQL_CHARACTER_SET_SERVER: utf8mb4
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
ports:
- "${MYSQL_PORT:-3306}:3306"
volumes:
- mysql_data:/var/lib/mysql
networks:
- verify-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7.0-alpine
container_name: verify-redis
restart: unless-stopped
command: redis-server --appendonly yes
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
networks:
- verify-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
app:
image: ghcr.io/cmakecpp/verify:main
container_name: verify-app
restart: unless-stopped
environment:
- APP_ENV=production
- APP_PORT=8080
- APP_JWT_SECRET=${JWT_SECRET:-your-jwt-secret-change-me}
- DATABASE_HOST=mysql
- DATABASE_PORT=3306
- DATABASE_NAME=${MYSQL_DATABASE:-verification_platform}
- DATABASE_USERNAME=root
- DATABASE_PASSWORD=${MYSQL_ROOT_PASSWORD:-root123456}
- REDIS_HOST=redis
- REDIS_PORT=6379
ports:
- "${APP_PORT:-8080}:8080"
volumes:
- uploads:/app/uploads
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- verify-network
volumes:
mysql_data:
redis_data:
uploads:
networks:
verify-network:
driver: bridge