🧑‍💻 Implement uv workspaces (#2090)

This commit is contained in:
Alejandra
2026-01-20 19:19:07 +01:00
committed by GitHub
parent fcad8f8270
commit 3a5611aa7f
9 changed files with 2073 additions and 1626 deletions

View File

@@ -2,16 +2,10 @@ FROM python:3.10
ENV PYTHONUNBUFFERED=1
WORKDIR /app/
# Install uv
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
# Place executables in the environment at the front of the path
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
ENV PATH="/app/.venv/bin:$PATH"
# Compile bytecode
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
ENV UV_COMPILE_BYTECODE=1
@@ -20,25 +14,32 @@ ENV UV_COMPILE_BYTECODE=1
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
ENV UV_LINK_MODE=copy
WORKDIR /app/
# Place executables in the environment at the front of the path
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
ENV PATH="/app/.venv/bin:$PATH"
# Install dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
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 --frozen --no-install-project
uv sync --frozen --no-install-workspace --package app
ENV PYTHONPATH=/app
COPY ./backend/scripts /app/backend/scripts
COPY ./scripts /app/scripts
COPY ./backend/pyproject.toml ./backend/alembic.ini /app/backend/
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
COPY ./app /app/app
COPY ./tests /app/tests
COPY ./backend/app /app/backend/app
# Sync the project
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --package app
WORKDIR /app/backend/
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]

View File

@@ -23,8 +23,8 @@ dependencies = [
"pyjwt<3.0.0,>=2.8.0",
]
[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"pytest<8.0.0,>=7.4.3",
"mypy<2.0.0,>=1.8.0",
"ruff<1.0.0,>=0.2.2",

1601
backend/uv.lock generated

File diff suppressed because it is too large Load Diff