@@ -9,4 +9,5 @@ COPY . .
EXPOSE 8100
-CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8100", "--workers", "8"]
+# 使用 waitress 运行 Flask 应用,监听 8100 端口
+CMD ["python", "-m", "waitress", "--host", "0.0.0.0", "--port", "8100", "--threads", "8", "app:app"]
@@ -1,34 +1,11 @@
services:
math-questions:
build: .
- # 不再直接暴露端口,通过 Nginx 访问
- # ports:
- # - "8100:8100"
+ container_name: math-questions-app
env_file:
- .env
restart: unless-stopped
- networks:
- - app-network
-
- nginx:
- image: nginx:alpine
ports:
- - "80:80"
- - "443:443"
- volumes:
- - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- - ./ssl:/etc/nginx/ssl:ro
- - nginx-logs:/var/log/nginx
- depends_on:
- - math-questions
- restart: unless-stopped
-volumes:
- nginx-logs:
+ - "8100:8100" # 外部访问 http://服务器IP:8100
-networks:
- app-network:
- driver: bridge
+# 使用默认 bridge 网络即可,这里就不单独配置 networks 了