fix:
Gitea Action for docker build runtime / build-runtime (push) Successful in 1m2s Details

This commit is contained in:
chenwj113 2024-06-12 10:13:11 +08:00
parent b23786319e
commit 088bee0199
1 changed files with 12 additions and 9 deletions

View File

@ -5,17 +5,15 @@ RUN mkdir /install
WORKDIR /install
# COPY requirements.txt .
COPY poetry.lock .
COPY pyproject.toml .
# RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list.d/debian.sources
# RUN apt-get update \
# && apt-get install gcc -y \
# && apt-get clean
# COPY requirements.txt .
# RUN pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --prefix=/install
COPY poetry.lock .
COPY pyproject.toml .
RUN pip install poetry -i https://mirrors.aliyun.com/pypi/simple/ \
&& poetry source add --priority=primary mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \
&& poetry config virtualenvs.path /install \
@ -28,11 +26,16 @@ FROM python:3.11-slim
COPY --from=build /install/*/lib/python3.11/ /usr/local/lib/python3.11/
COPY --from=build /install/*/bin/ /usr/local/bin/
# 删除不需要的文件和工具,精简镜像
RUN apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc \
&& rm -rf /usr/share/man \
&& rm -rf /usr/local/bin/pip
RUN mkdir -p /app
# COPY . /app
WORKDIR /app
# COPY . /app
ENV FAST_API_ENV=prod