全提交
This commit is contained in:
+11
-9
@@ -1,20 +1,22 @@
|
||||
# 多阶段构建:前端静态 → 后端镜像
|
||||
FROM python:3.11-slim
|
||||
FROM python:3.11-alpine
|
||||
WORKDIR /app
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
TZ=Asia/Shanghai
|
||||
RUN sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list && \
|
||||
sed -i 's|security.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list && \
|
||||
apt-get update -o Acquire::Retries=3 -o Acquire::http::Timeout=30 && \
|
||||
apt-get install -y --no-install-recommends tzdata && \
|
||||
ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
TZ=Asia/Shanghai \
|
||||
PIP_INDEX_URL=https://mirrors.cloud.tencent.com/pypi/simple \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
AUTO_IMPORT_ON_START=1
|
||||
RUN apk add --no-cache tzdata && \
|
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
|
||||
COPY backend/requirements.txt .
|
||||
RUN pip install --no-cache-dir -i https://mirrors.cloud.tencent.com/pypi/simple -r requirements.txt
|
||||
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
|
||||
COPY backend/ ./backend/
|
||||
COPY frontend/ ./frontend/
|
||||
COPY config.json ./config.json
|
||||
COPY seed/ /app/init/
|
||||
RUN mkdir -p /app/data
|
||||
VOLUME ["/app/data"]
|
||||
EXPOSE 57778
|
||||
CMD ["python", "backend/app.py"]
|
||||
|
||||
Reference in New Issue
Block a user