feat: add .venv to dockerignore and optimize Dockerfile with cache mounts for uv (#145)

Change-Id: I27ff2d4f9bcdedbd0135e109ecb6aa6d78bc488b
This commit is contained in:
cndoit18 2025-05-17 21:21:55 +08:00 committed by GitHub
parent 9dc78c3829
commit d69128495b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
.venv/
# Web
node_modules

View File

@ -5,11 +5,18 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
WORKDIR /app
# Pre-cache the application dependencies.
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project
# Copy the application into the container.
COPY . /app
# Install the application dependencies.
RUN uv sync --frozen --no-cache
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked
EXPOSE 8000