11# Build in a full featured container
22ARG TARGETARCH
3+ ARG UV_IMAGE=ghcr.io/astral-sh/uv:latest
4+ FROM --platform=linux/$TARGETARCH ${UV_IMAGE} AS uv
35FROM --platform=linux/$TARGETARCH python:3.11-bullseye AS build
46
57# Install protobuf compiler
68RUN apt-get update \
7- && DEBIAN_FRONTEND=noninteractive \
9+ && DEBIAN_FRONTEND=noninteractive \
810 apt-get install --no-install-recommends --assume-yes \
9- protobuf-compiler=3.12.4-1+deb11u1 libprotobuf-dev=3.12.4-1+deb11u1
11+ protobuf-compiler=3.12.4-1+deb11u1 libprotobuf-dev=3.12.4-1+deb11u1
1012
1113# Get go compiler
1214ARG TARGETARCH
@@ -20,7 +22,7 @@ RUN wget -q -O - https://sh.rustup.rs | sh -s -- -y
2022ENV PATH="$PATH:/root/.cargo/bin"
2123
2224# Install uv
23- COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
25+ COPY --from=uv /uv /uvx /bin/
2426
2527WORKDIR /app
2628
@@ -46,12 +48,21 @@ COPY workers/python ./workers/python
4648# Build the worker
4749RUN CGO_ENABLED=0 ./temporal-omes prepare-worker --language python --dir-name prepared --version "$SDK_VERSION"
4850
51+ # Download the worker dependencies
52+ WORKDIR /app/workers/python/prepared
53+ RUN uv lock \
54+ && uv sync --frozen \
55+ && . .venv/bin/activate && python -m compileall -q .
56+
4957# Copy the CLI and built worker to a distroless "run" container
5058FROM --platform=linux/$TARGETARCH python:3.11-slim-bullseye
5159
52- COPY --from=build /bin/ uv /bin/uv
60+ COPY --from=uv / uv /uvx / bin/
5361COPY --from=build /app/temporal-omes /app/temporal-omes
5462COPY --from=build /app/workers/python /app/workers/python
5563
64+ ENV UV_OFFLINE=1 UV_FROZEN=1 UV_NO_SYNC=1 UV_ISOLATED=1 UV_PROJECT_ENVIRONMENT="/app/workers/python/prepared/.venv"
65+ ENV PATH="/app/workers/python/prepared/.venv/bin:${PATH}"
66+
5667# Put the language and dir, but let other options (like required scenario and run-id) be given by user
5768ENTRYPOINT ["/app/temporal-omes" , "run-worker" , "--language" , "python" , "--dir-name" , "prepared" ]
0 commit comments