Problem / Motivation
The current backend Dockerfile installs dependencies using:
RUN uv pip install --system -r pyproject.toml
However, pyproject.toml is not a requirements file and using it with -r is not the recommended workflow for uv. This may lead to inconsistent dependency resolution and does not fully leverage the existing uv.lock file for reproducible builds.
Additionally, the current Dockerfile can be improved for:
better Docker layer caching,
smaller rebuild times,
cleaner production practices,
and improved container reliability.
Proposed Solution
Refactor the backend Dockerfile to use a proper uv workflow such as:
RUN uv sync --frozen --no-dev
Additional improvements:
optimize dependency caching by copying dependency files before source files,
add production-friendly Python environment variables,
improve runtime execution consistency using uv run,
optionally introduce .dockerignore recommendations.
Example improvements include:
deterministic builds using uv.lock,
faster rebuilds,
cleaner container behavior in production and CI/CD environments.
Alternatives Considered
Continuing with uv pip install --system -r pyproject.toml
not aligned with recommended uv workflows,
does not fully utilize lockfile reproducibility.
Exporting requirements.txt manually
adds unnecessary maintenance overhead when uv.lock already exists.
Problem / Motivation
The current backend Dockerfile installs dependencies using:
RUN uv pip install --system -r pyproject.toml
However, pyproject.toml is not a requirements file and using it with -r is not the recommended workflow for uv. This may lead to inconsistent dependency resolution and does not fully leverage the existing uv.lock file for reproducible builds.
Additionally, the current Dockerfile can be improved for:
better Docker layer caching,
smaller rebuild times,
cleaner production practices,
and improved container reliability.
Proposed Solution
Refactor the backend Dockerfile to use a proper uv workflow such as:
RUN uv sync --frozen --no-dev
Additional improvements:
optimize dependency caching by copying dependency files before source files,
add production-friendly Python environment variables,
improve runtime execution consistency using uv run,
optionally introduce .dockerignore recommendations.
Example improvements include:
deterministic builds using uv.lock,
faster rebuilds,
cleaner container behavior in production and CI/CD environments.
Alternatives Considered
Continuing with uv pip install --system -r pyproject.toml
not aligned with recommended uv workflows,
does not fully utilize lockfile reproducibility.
Exporting requirements.txt manually
adds unnecessary maintenance overhead when uv.lock already exists.