Skip to content

Commit 8e8cfaf

Browse files
[codex] install backend Docker deps from uv locks (#8328)
## Summary - install backend and pusher Docker Python dependencies from uv pylock files - add runtime-only backend and pusher-specific lock files for Linux container builds - update lock regeneration docs/script behavior so existing pins are preserved by default and `PYLOCK_UPGRADE=1` performs intentional upgrades - add the missing pusher `google-cloud-tasks` dependency surfaced by container smoke testing ## Validation - `./scripts/update-python-lock.sh` - `sh -n backend/scripts/update-python-lock.sh` - workflow YAML parse checks for backend workflows - `git diff --check` - `./scripts/pre-commit` - Oracle second-model review, with must-fix feedback addressed - `docker pull --platform linux/amd64 gcr.io/based-hardware-dev/python:3.11-slim-forky` - `docker build --platform linux/amd64 -f backend/Dockerfile -t omi-backend-uv-runtime:gcr-test .` - `docker run --rm --platform linux/amd64 omi-backend-uv-runtime:gcr-test python -c "from google.cloud import tasks_v2; import fastapi, uvicorn, onnxruntime, lc3, av; print('backend runtime imports ok')"` - `docker build --platform linux/amd64 -f backend/pusher/Dockerfile -t omi-pusher-uv-runtime:gcr-test .` - `docker run --rm --platform linux/amd64 omi-pusher-uv-runtime:gcr-test python -c "from google.cloud import tasks_v2; import fastapi, uvicorn, lc3, av, scipy; print('pusher runtime imports ok')"` ## Notes - `backend/test-preflight.sh` was not a useful signal on this machine because the local shell is on Python 3.9 without backend packages installed; Redis and test file checks were fine. - Docker still reports the existing `$LD_LIBRARY_PATH` undefined-var warning in these Dockerfiles; it does not block either image build. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/8328?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
2 parents c5c08f9 + 846b950 commit 8e8cfaf

12 files changed

Lines changed: 2524 additions & 24 deletions

File tree

backend/AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ When intentionally changing backend Python dependencies, edit the relevant `requ
1919
./scripts/update-python-lock.sh
2020
```
2121

22+
By default, the lock refresh preserves already-locked package versions so unrelated transitive upgrades do not sneak into infrastructure changes. Set `PYLOCK_UPGRADE=1` only when intentionally refreshing dependency versions.
23+
2224
Key env vars: `OPENAI_API_KEY` (LLM calls — not `OPENAI_ADMIN_KEY` which is billing-only), `DEEPGRAM_API_KEY` (STT), `ENCRYPTION_SECRET` (required for tests), `REDIS_DB_HOST` (cache/rate-limiting, fail-open without it), `ADMIN_KEY` (local dev auth bypass via token `ADMIN_KEY<uid>`), `SERVICE_ACCOUNT_JSON` (Firestore/GCS credentials).
2325

2426
## Directory Structure

backend/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
FROM gcr.io/based-hardware-dev/python:3.11-slim-forky AS builder
1+
ARG PYTHON_BASE_IMAGE=gcr.io/based-hardware-dev/python:3.11-slim-forky
2+
ARG UV_VERSION=0.11.13
3+
4+
FROM ${PYTHON_BASE_IMAGE} AS builder
5+
6+
ARG UV_VERSION
27

3-
ENV PATH="/opt/venv/bin:$PATH"
48
RUN python -m venv /opt/venv
9+
RUN python3 -m pip install --no-cache-dir "uv==${UV_VERSION}"
10+
ENV PATH="/opt/venv/bin:$PATH"
511

612
# Install build dependencies for liblc3
713
RUN apt-get update && apt-get install -y \
@@ -28,12 +34,12 @@ RUN git clone https://github.com/google/liblc3.git && \
2834
cd /tmp/liblc3 && \
2935
python3 -m pip wheel --no-cache-dir --wheel-dir /tmp/wheels .
3036

31-
# Install Python requirements
37+
# Install Python requirements from the checked-in runtime lock.
3238
WORKDIR /opt/venv
33-
COPY backend/requirements.txt /tmp/requirements.txt
34-
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
39+
COPY backend/pylock.runtime.toml /tmp/pylock.runtime.toml
40+
RUN uv pip sync /tmp/pylock.runtime.toml --python /opt/venv/bin/python --compile-bytecode
3541

36-
FROM gcr.io/based-hardware-dev/python:3.11-slim-forky
42+
FROM ${PYTHON_BASE_IMAGE}
3743

3844
WORKDIR /app
3945
ENV PATH="/opt/venv/bin:$PATH"

backend/pusher/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
FROM gcr.io/based-hardware-dev/python:3.11-slim-forky AS builder
1+
ARG PYTHON_BASE_IMAGE=gcr.io/based-hardware-dev/python:3.11-slim-forky
2+
ARG UV_VERSION=0.11.13
3+
4+
FROM ${PYTHON_BASE_IMAGE} AS builder
5+
6+
ARG UV_VERSION
27

3-
ENV PATH="/opt/venv/bin:$PATH"
48
RUN python -m venv /opt/venv
9+
RUN python3 -m pip install --no-cache-dir "uv==${UV_VERSION}"
10+
ENV PATH="/opt/venv/bin:$PATH"
511

612
# Install build dependencies for liblc3
713
RUN apt-get update && apt-get install -y \
@@ -28,12 +34,12 @@ RUN git clone https://github.com/google/liblc3.git && \
2834
cd /tmp/liblc3 && \
2935
python3 -m pip wheel --no-cache-dir --wheel-dir /tmp/wheels .
3036

31-
# Install Python requirements pusher-specific (no torch/onnxruntime/pyannote)
37+
# Install Python requirements from the pusher-specific checked-in lock.
3238
WORKDIR /opt/venv
33-
COPY backend/pusher/requirements.txt /tmp/requirements.txt
34-
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
39+
COPY backend/pusher/pylock.toml /tmp/pylock.toml
40+
RUN uv pip sync /tmp/pylock.toml --python /opt/venv/bin/python --compile-bytecode
3541

36-
FROM gcr.io/based-hardware-dev/python:3.11-slim-forky
42+
FROM ${PYTHON_BASE_IMAGE}
3743

3844
WORKDIR /app
3945
ENV PATH="/opt/venv/bin:$PATH"

backend/pusher/pylock.toml

Lines changed: 913 additions & 0 deletions
Large diffs are not rendered by default.

backend/pusher/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pydantic_core==2.33.2
1919
firebase-admin==6.5.0
2020
google-cloud-firestore==2.20.0
2121
google-cloud-storage==2.18.0
22+
google-cloud-tasks==2.16.4
2223
google-cloud-translate==3.20.2
2324
google-auth==2.32.0
2425
google-api-python-client==2.139.0

backend/pylock.macos-x86_64.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# backend/scripts/update-python-lock.sh
33
lock-version = "1.0"
44
created-by = "uv"
5-
requires-python = ">=3.11.15"
5+
requires-python = ">=3.11,<3.12"
66

77
[[packages]]
88
name = "aenum"

backend/pylock.macos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# backend/scripts/update-python-lock.sh
33
lock-version = "1.0"
44
created-by = "uv"
5-
requires-python = ">=3.11.15"
5+
requires-python = ">=3.11,<3.12"
66

77
[[packages]]
88
name = "aenum"

backend/pylock.runtime.toml

Lines changed: 1557 additions & 0 deletions
Large diffs are not rendered by default.

backend/pylock.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# backend/scripts/update-python-lock.sh
33
lock-version = "1.0"
44
created-by = "uv"
5-
requires-python = ">=3.11.15"
5+
requires-python = ">=3.11,<3.12"
66

77
[[packages]]
88
name = "aenum"

backend/pylock.windows.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# backend/scripts/update-python-lock.sh
33
lock-version = "1.0"
44
created-by = "uv"
5-
requires-python = ">=3.11.15"
5+
requires-python = ">=3.11,<3.12"
66

77
[[packages]]
88
name = "aenum"

0 commit comments

Comments
 (0)