Files
PushToZhaoShang/Dockerfile
T

22 lines
891 B
Docker
Raw Normal View History

2025-12-07 21:04:24 +08:00
# 多阶段构建:前端静态 → 后端镜像
2025-12-07 21:55:56 +08:00
FROM python:3.11-alpine
2025-12-07 21:04:24 +08:00
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
2025-12-07 21:55:56 +08:00
TZ=Asia/Shanghai \
PIP_INDEX_URL=https://mirrors.cloud.tencent.com/pypi/simple \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
AUTO_IMPORT_ON_START=1
2025-12-07 22:05:40 +08:00
RUN sed -i -e 's/dl-cdn.alpinelinux.org/mirrors.cloud.tencent.com/g' /etc/apk/repositories && \
apk update && apk add --no-cache tzdata && \
2025-12-07 21:55:56 +08:00
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
2025-12-07 21:04:24 +08:00
COPY backend/requirements.txt .
2025-12-07 21:55:56 +08:00
RUN python -m pip install --no-cache-dir --upgrade pip -i $PIP_INDEX_URL && \
pip install --no-cache-dir -r requirements.txt -i $PIP_INDEX_URL
2025-12-07 21:04:24 +08:00
COPY backend/ ./backend/
COPY frontend/ ./frontend/
COPY config.json ./config.json
2025-12-07 21:55:56 +08:00
RUN mkdir -p /app/data
2025-12-07 21:04:24 +08:00
VOLUME ["/app/data"]
EXPOSE 57778
CMD ["python", "backend/app.py"]