fix: bug
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,9 +1,20 @@
|
||||
FROM python:3.11-slim
|
||||
# syntax=docker/dockerfile:1
|
||||
# 国内拉基础镜像慢时:docker compose build --build-arg PY_BASE=docker.m.daocloud.io/library/python:3.11-slim
|
||||
ARG PY_BASE=python:3.11-slim
|
||||
FROM ${PY_BASE}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 默认清华 PyPI;海外可:docker compose build --build-arg PIP_INDEX_URL=https://pypi.org/simple
|
||||
ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
ENV PIP_INDEX_URL=${PIP_INDEX_URL} \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_DEFAULT_TIMEOUT=120
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# BuildKit 缓存加速重复构建;需 Docker 20.10+(compose 默认开 BuildKit)
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user