Skip to content

Commit

Permalink
update docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmyuan committed Oct 5, 2024
1 parent ae64b07 commit bc51bb7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# 第一阶段:安装依赖
FROM python:3.12-slim AS builder

# 安装 Poetry
RUN pip install poetry

WORKDIR /app

COPY pyproject.toml poetry.lock ./

# 安装 Poetry
RUN pip install poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# 使用 Poetry 安装依赖
RUN poetry config virtualenvs.create false \
&& poetry install --no-root --no-interaction --no-ansi --only main
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR

# 第二阶段:构建最终镜像
FROM python:3.12-slim
Expand Down

0 comments on commit bc51bb7

Please sign in to comment.