diff --git a/.github/workflows/ai-code-review.yml b/.github/workflows/ai-code-review.yml index 3a4c3a9d6a..8976272fa4 100644 --- a/.github/workflows/ai-code-review.yml +++ b/.github/workflows/ai-code-review.yml @@ -27,7 +27,7 @@ jobs: uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b id: setup-uv with: - version: "0.5.5" + version: "0.12.5" enable-cache: true - name: Find existing Claude bot comment id: find-comment diff --git a/.github/workflows/backend-checks.yml b/.github/workflows/backend-checks.yml index de33fe357f..f0019bf877 100644 --- a/.github/workflows/backend-checks.yml +++ b/.github/workflows/backend-checks.yml @@ -23,7 +23,7 @@ jobs: uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b id: setup-uv with: - version: "0.5.5" + version: "0.12.5" enable-cache: true - name: Install python dependencies diff --git a/.github/workflows/backend-test.yml b/.github/workflows/backend-test.yml index 4ff391464d..4c4651834c 100644 --- a/.github/workflows/backend-test.yml +++ b/.github/workflows/backend-test.yml @@ -43,7 +43,7 @@ jobs: uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b id: setup-uv with: - version: "0.5.5" + version: "0.12.5" enable-cache: true - run: pip install codecov diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index b00feb72b7..e8685a9798 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -37,7 +37,7 @@ jobs: uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b id: setup-uv with: - version: "0.5.5" + version: "0.12.5" enable-cache: true - name: Run Claude uses: anthropics/claude-code-action@v1 diff --git a/.github/workflows/graphql-schema.yml b/.github/workflows/graphql-schema.yml index fef0d214cf..ef4d8d6232 100644 --- a/.github/workflows/graphql-schema.yml +++ b/.github/workflows/graphql-schema.yml @@ -27,7 +27,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b with: - version: "0.5.5" + version: "0.12.5" enable-cache: true - name: Install dependencies diff --git a/Dockerfile.python.local b/Dockerfile.python.local index 023fe04fb2..b2457963ac 100644 --- a/Dockerfile.python.local +++ b/Dockerfile.python.local @@ -9,7 +9,9 @@ ARG FUNCTION_DIR RUN mkdir -p ${FUNCTION_DIR} WORKDIR ${FUNCTION_DIR} -RUN pip install uv==0.5.5 +COPY --from=ghcr.io/astral-sh/uv:0.12.5 /uv /uvx /usr/local/bin/ +ENV UV_PROJECT_ENVIRONMENT=/opt/venv +ENV PATH="/opt/venv/bin:${PATH}" RUN mkdir -p ${FUNCTION_DIR}/assets diff --git a/backend/Dockerfile b/backend/Dockerfile index 8b3e37c761..3af0515d2e 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -24,13 +24,14 @@ FROM base AS build-stage ARG FUNCTION_DIR -RUN apt-get update -y && apt-get install -y \ - gcc git +RUN apt-get update -y && apt-get install -y gcc git RUN mkdir -p ${FUNCTION_DIR} WORKDIR ${FUNCTION_DIR} -RUN pip install uv==0.5.5 +COPY --from=ghcr.io/astral-sh/uv:0.12.5 /uv /uvx /usr/local/bin/ +ENV UV_PROJECT_ENVIRONMENT=/opt/venv +ENV PATH="/opt/venv/bin:${PATH}" COPY pyproject.toml uv.lock ./ @@ -38,7 +39,7 @@ RUN uv sync --no-dev COPY . ./ -RUN .venv/bin/python manage.py graphql_schema +RUN python manage.py graphql_schema # Build custom admin components @@ -81,12 +82,15 @@ ENV NLTK_DATA=/home/app/nltk_data COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/*.html ${FUNCTION_DIR}/custom_admin/templates/astro/ COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/widgets/*.html ${FUNCTION_DIR}/custom_admin/templates/astro/widgets/ COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/_astro ${FUNCTION_DIR}/custom_admin/static/_astro/ -COPY --chown=app:app --from=build-stage ${FUNCTION_DIR}/.venv ${FUNCTION_DIR}/.venv +COPY --chown=app:app --from=build-stage /opt/venv /opt/venv COPY --chown=app:app . ${FUNCTION_DIR} COPY ./entrypoint.sh /entrypoint.sh -RUN mkdir -p assets && .venv/bin/python manage.py collectstatic --noinput +ENV UV_PROJECT_ENVIRONMENT=/opt/venv +ENV PATH="/opt/venv/bin:${PATH}" + +RUN mkdir -p assets && python manage.py collectstatic --noinput ENV PGSSLCERT=/tmp/postgresql.crt diff --git a/infrastructure/applications/pycon_backend/web_task.tf b/infrastructure/applications/pycon_backend/web_task.tf index 9deabf302e..62df88c44f 100644 --- a/infrastructure/applications/pycon_backend/web_task.tf +++ b/infrastructure/applications/pycon_backend/web_task.tf @@ -9,7 +9,7 @@ resource "aws_ecs_task_definition" "web" { essential = true command = [ - "/home/app/.venv/bin/gunicorn", "-w", "5", "-b", "0.0.0.0:8000", "pycon.wsgi" + "gunicorn", "-w", "5", "-b", "0.0.0.0:8000", "pycon.wsgi" ] dockerLabels = { diff --git a/infrastructure/applications/pycon_backend/worker.tf b/infrastructure/applications/pycon_backend/worker.tf index 180b812047..b691ddfc0b 100644 --- a/infrastructure/applications/pycon_backend/worker.tf +++ b/infrastructure/applications/pycon_backend/worker.tf @@ -220,7 +220,7 @@ resource "aws_ecs_task_definition" "worker" { essential = true command = [ - "/home/app/.venv/bin/celery", "-A", "pycon", "worker", "-l", "info", "-E" + "celery", "-A", "pycon", "worker", "-l", "info", "-E" ] environment = local.env_vars @@ -261,7 +261,7 @@ resource "aws_ecs_task_definition" "worker" { essential = false command = [ - "/home/app/.venv/bin/python", "manage.py", "migrate" + "bin/python", "manage.py", "migrate" ] environment = local.env_vars @@ -312,7 +312,7 @@ resource "aws_ecs_task_definition" "beat" { essential = true command = [ - "/home/app/.venv/bin/celery", "-A", "pycon", "beat", "-l", "info" + "celery", "-A", "pycon", "beat", "-l", "info" ] environment = local.env_vars diff --git a/infrastructure/applications/pycon_backend/worker_heavy_processing.tf b/infrastructure/applications/pycon_backend/worker_heavy_processing.tf index e4596a09f0..6d0cc7348a 100644 --- a/infrastructure/applications/pycon_backend/worker_heavy_processing.tf +++ b/infrastructure/applications/pycon_backend/worker_heavy_processing.tf @@ -24,7 +24,7 @@ resource "aws_ecs_task_definition" "heavy_processing_worker" { essential = true command = [ - "/home/app/.venv/bin/celery", "-A", "pycon", "worker", "-l", "info", "-Q", "heavy_processing", "--hostname", "heavyprocessing@%h", "-E" + "celery", "-A", "pycon", "worker", "-l", "info", "-Q", "heavy_processing", "--hostname", "heavyprocessing@%h", "-E" ] environment = local.env_vars