Skip to content

Commit 436bf46

Browse files
committed
Offline Python worker
1 parent 243c8f7 commit 436bf46

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dockerfiles/python.Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Build in a full featured container
22
ARG TARGETARCH
3+
ARG UV_IMAGE=ghcr.io/astral-sh/uv:latest
4+
FROM --platform=linux/$TARGETARCH ${UV_IMAGE} AS uv
35
FROM --platform=linux/$TARGETARCH python:3.11-bullseye AS build
46

57
# Install protobuf compiler
68
RUN 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
1214
ARG TARGETARCH
@@ -20,7 +22,7 @@ RUN wget -q -O - https://sh.rustup.rs | sh -s -- -y
2022
ENV 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

2527
WORKDIR /app
2628

@@ -46,10 +48,14 @@ COPY workers/python ./workers/python
4648
# Build the worker
4749
RUN CGO_ENABLED=0 ./temporal-omes prepare-worker --language python --dir-name prepared --version "$SDK_VERSION"
4850

51+
# Download the worker dependencies for offline use
52+
WORKDIR /app/workers/python/prepared
53+
RUN uv lock && uv sync --frozen
54+
4955
# Copy the CLI and built worker to a distroless "run" container
5056
FROM --platform=linux/$TARGETARCH python:3.11-slim-bullseye
5157

52-
COPY --from=build /bin/uv /bin/uv
58+
COPY --from=uv /uv /uvx /bin/
5359
COPY --from=build /app/temporal-omes /app/temporal-omes
5460
COPY --from=build /app/workers/python /app/workers/python
5561

0 commit comments

Comments
 (0)