提交 dde80025 authored 作者: zhanglu's avatar zhanglu

v1 docker build

上级 ade792f7
...@@ -3,3 +3,4 @@ chunk_*.js ...@@ -3,3 +3,4 @@ chunk_*.js
vendor.js vendor.js
manifest.js manifest.js
frontend/node_modules frontend/node_modules
.idea
\ No newline at end of file
__pycache__ __pycache__
*.pyc *.pyc
*.pyo *.pyo
.env
.venv .venv
node_modules node_modules
tests tests
......
# Backend — Python 3.11 + FastAPI + uvicorn # Backend — Python 3.11 + FastAPI + uvicorn
FROM python:3.11-slim FROM docker.1ms.run/python:3.11-slim
WORKDIR /app WORKDIR /law_order
# Install dependencies # Install dependencies
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# Copy source # Copy source
COPY main.py main.py COPY main.py main.py
COPY app/ app/ COPY app/ /law_order/app
COPY .env .env COPY data/ /law_order/data
COPY logs/ /law_order/logs
# Create directories COPY .env /law_order/.env
RUN mkdir -p /app/data /app/logs
EXPOSE 8080 EXPOSE 8080
......
...@@ -7,3 +7,5 @@ requests==2.31.0 ...@@ -7,3 +7,5 @@ requests==2.31.0
pycryptodome==3.19.0 pycryptodome==3.19.0
apscheduler==3.10.4 apscheduler==3.10.4
aiohttp==3.9.1 aiohttp==3.9.1
PyJWT==2.10.1
bcrypt
\ No newline at end of file
# Frontend — build React + serve with Nginx # Frontend — build React + serve with Nginx
FROM node:20-alpine AS build FROM docker.1ms.run/node:20-alpine AS build
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
...@@ -7,7 +7,7 @@ RUN npm ci --production=false ...@@ -7,7 +7,7 @@ RUN npm ci --production=false
COPY . . COPY . .
RUN npm run build RUN npm run build
FROM nginx:alpine FROM docker.1ms.run/nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
......
...@@ -13,7 +13,7 @@ server { ...@@ -13,7 +13,7 @@ server {
# Backend API proxy # Backend API proxy
location /api/ { location /api/ {
proxy_pass http://law_order_backend:8080; proxy_pass http://192.168.0.143:8080;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
...@@ -23,7 +23,7 @@ server { ...@@ -23,7 +23,7 @@ server {
# WebSocket support (future SSE/log streaming) # WebSocket support (future SSE/log streaming)
location /ws/ { location /ws/ {
proxy_pass http://law_order_backend:8080; proxy_pass http://192.168.0.143:8080;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论