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
|
FROM harbor.dc.teramesh.cn/library/deploybase-python:3.11-slim
|
||||||
|
|
||||||
|
ENV PATH=/root/.local/bin:$PATH
|
||||||
|
|
||||||
# 设置环境变量
|
# 设置环境变量
|
||||||
ENV PYTHONUNBUFFERED=1 \
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
# 安装系统依赖
|
## 安装系统依赖
|
||||||
RUN apt-get update && apt-get install -y \
|
#RUN apt-get update && apt-get install -y \
|
||||||
gcc \
|
# gcc \
|
||||||
libpq-dev \
|
# libpq-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
# && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 设置工作目录
|
# 设置工作目录
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 复制依赖文件并安装
|
# copy packages
|
||||||
COPY requirements.txt .
|
COPY --from=builder /root/.local /root/.local
|
||||||
#RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
COPY --from=builder /root/.pyarmor /root/.pyarmor
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-warn-script-location --user --default-timeout 90 -r requirements.txt
|
|
||||||
|
## 复制依赖文件并安装
|
||||||
|
#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 . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user