This commit is contained in:
parent
64dc576ed0
commit
6ab6012032
34
Dockerfile
34
Dockerfile
|
|
@ -1,22 +1,38 @@
|
|||
FROM harbor.dc.teramesh.cn/library/buildbase-python:3.11-slim AS builder
|
||||
|
||||
# install python packages
|
||||
ARG PIP_INDEX_URL
|
||||
ENV PIP_INDEX_URL=$PIP_INDEX_URL
|
||||
|
||||
COPY requirements.txt /requirements.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-warn-script-location --user --default-timeout 90 -r /requirements.txt
|
||||
|
||||
|
||||
FROM harbor.dc.teramesh.cn/library/deploybase-python:3.11-slim
|
||||
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
|
||||
# 设置环境变量
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# 安装系统依赖
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
## 安装系统依赖
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# gcc \
|
||||
# libpq-dev \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制依赖文件并安装
|
||||
COPY requirements.txt .
|
||||
#RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-warn-script-location --user --default-timeout 90 -r requirements.txt
|
||||
# copy packages
|
||||
COPY --from=builder /root/.local /root/.local
|
||||
COPY --from=builder /root/.pyarmor /root/.pyarmor
|
||||
|
||||
## 复制依赖文件并安装
|
||||
#COPY requirements.txt .
|
||||
##RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
||||
#RUN --mount=type=cache,target=/root/.cache/pip pip install --no-warn-script-location --user --default-timeout 90 -r requirements.txt
|
||||
# 复制应用代码
|
||||
COPY . .
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user