fix: 优化docker构建速度
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
FROM python:3.10-slim
|
||||
ARG PYTHON_IMAGE=registry.cn-hangzhou.aliyuncs.com/library/python:3.10-slim
|
||||
FROM ${PYTHON_IMAGE}
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
ARG APT_MIRROR=mirrors.aliyun.com
|
||||
ARG PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
||||
ARG PIP_TRUSTED_HOST=mirrors.aliyun.com
|
||||
|
||||
RUN sed -i "s@deb.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources \
|
||||
&& sed -i "s@security.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
RUN pip config set global.index-url "${PIP_INDEX_URL}" \
|
||||
&& pip config set global.trusted-host "${PIP_TRUSTED_HOST}" \
|
||||
&& pip install -r /app/requirements.txt
|
||||
|
||||
COPY app /app/app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user