|
@@ -9,23 +9,25 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
TZ=Asia/Shanghai \
|
|
TZ=Asia/Shanghai \
|
|
- PATH="/root/.local/bin:$PATH"
|
|
|
|
|
|
+ PATH="/root/.local/bin:$PATH" \
|
|
|
|
+ DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
-# 安装系统依赖(构建 wheel、时区等)
|
|
|
|
|
|
+# 替换 apt 源(国内构建会快很多,可选)
|
|
|
|
+RUN sed -i 's|http://deb.debian.org/debian|http://mirrors.aliyun.com/debian|g' /etc/apt/sources.list \
|
|
|
|
+ && sed -i 's|http://security.debian.org/debian-security|http://mirrors.aliyun.com/debian-security|g' /etc/apt/sources.list
|
|
|
|
+
|
|
|
|
+# 安装系统依赖(如果 requirements 里需要编译 C 扩展)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
build-essential \
|
|
curl \
|
|
curl \
|
|
tzdata \
|
|
tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
-# 设置时区
|
|
|
|
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
-
|
|
|
|
-# 复制 requirements 并安装依赖
|
|
|
|
|
|
+# 先复制 requirements 并安装依赖(利用缓存)
|
|
COPY requirements.txt .
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
|
|
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
|
|
|
|
|
|
-# 复制项目文件
|
|
|
|
|
|
+# 再复制项目文件
|
|
COPY . .
|
|
COPY . .
|
|
|
|
|
|
# 暴露端口
|
|
# 暴露端口
|