From 0586999b4daef940b413cffd813bd9bd3882c8df Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 7 Sep 2025 13:35:42 +0100 Subject: [PATCH 1/3] Use `--locked` over `--frozen` in production Docker image https://github.com/astral-sh/uv-docker-example/pull/53 --- .../compose/production/django/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index 155637809..d7999cd9f 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -44,7 +44,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ 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 --no-dev + uv sync --locked --no-install-project --no-dev {%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %} COPY --from=client-builder ${APP_HOME} ${APP_HOME} {% else %} @@ -54,7 +54,7 @@ COPY . ${APP_HOME} 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-dev + uv sync --locked --no-dev # Python 'run' stage FROM python:3.12-slim-bookworm AS python-run-stage From 68c230baf6c79d5fbc07aef7f6a5858ea09d50f2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 7 Sep 2025 13:37:06 +0100 Subject: [PATCH 2/3] Fix indentation --- {{cookiecutter.project_slug}}/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml index 20e3a206e..f81d896f8 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version-file: ".python-version" + python-version-file: ".python-version" - name: Install dependencies run: uv sync From ae6e8f1a2137fd9d75812ff53531c9381945a521 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 7 Sep 2025 13:37:24 +0100 Subject: [PATCH 3/3] Use `--locked` when sync deps on CI --- {{cookiecutter.project_slug}}/.drone.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/ci.yml | 2 +- {{cookiecutter.project_slug}}/.gitlab-ci.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.drone.yml b/{{cookiecutter.project_slug}}/.drone.yml index f8b654b12..80dacf89d 100644 --- a/{{cookiecutter.project_slug}}/.drone.yml +++ b/{{cookiecutter.project_slug}}/.drone.yml @@ -39,7 +39,7 @@ steps: {%- else %} image: ghcr.io/astral-sh/uv:python3.12 commands: - - uv sync --frozen + - uv sync --locked - uv run pytest {%- endif%} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml index f81d896f8..0faf12235 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: python-version-file: ".python-version" - name: Install dependencies - run: uv sync + run: uv sync --locked - name: Check DB Migrations run: uv run python manage.py makemigrations --check diff --git a/{{cookiecutter.project_slug}}/.gitlab-ci.yml b/{{cookiecutter.project_slug}}/.gitlab-ci.yml index c881e2214..e7a31d90a 100644 --- a/{{cookiecutter.project_slug}}/.gitlab-ci.yml +++ b/{{cookiecutter.project_slug}}/.gitlab-ci.yml @@ -45,7 +45,7 @@ pytest: variables: DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB before_script: - - uv sync --frozen + - uv sync --locked script: - uv run pytest {%- endif %}