diff --git a/.gitignore b/.gitignore index ee9abab..248e31e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__/ venv/ .idea/ .vscode/ +.data/ # ---- Python (backend) ---- backend/__pycache__/ diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..6657381 --- /dev/null +++ b/backend/Dockerfile @@ -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"] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..26cdd5b --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..e69de29