feat: docker-compose.yml

This commit is contained in:
李如威 2025-09-29 13:18:07 +08:00
parent 45fab652a0
commit fbc1d0a6ae
4 changed files with 44 additions and 0 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ __pycache__/
venv/ venv/
.idea/ .idea/
.vscode/ .vscode/
.data/
# ---- Python (backend) ---- # ---- Python (backend) ----
backend/__pycache__/ backend/__pycache__/

18
backend/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
# ====== python step ======
FROM python:3.13 AS python
# ====== install step ======
FROM python AS install
# ENV PIP_SOURCE https://pypi.tuna.tsinghua.edu.cn/simple/
ENV PIP_SOURCE https://mirrors.aliyun.com/pypi/simple
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install -i $PIP_SOURCE --upgrade pip --timeout=100
RUN pip3 install -i $PIP_SOURCE -r requirements.txt
# ====== run step ======
FROM install AS run
COPY . /app
# CMD ["python", "server.py"]
EXPOSE 8080
ENTRYPOINT ["python3"]
CMD ["server.py"]

25
docker-compose.yml Normal file
View File

@ -0,0 +1,25 @@
services:
workflow-server:
container_name: workflow-server
networks:
- workflow
build:
context: ./backend
volumes:
- .data/:/app/app/config/
workflow-web:
container_name: workflow-web
networks:
- workflow
image: nginx:alpine
volumes:
- ./frontend/dist:/usr/share/nginx/html # 挂载前端构建文件
- ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf # 挂载 Nginx 配置
ports:
- "1338:80" # 将 Nginx 的 80 端口映射到主机的 1337 端口
depends_on:
- dbdai-server # 确保 Sanic 服务先启动
networks:
ai-guard:
external: true

0
frontend/nginx.conf Normal file
View File