Skip to content

Commit c23450b

Browse files
committed
Offline Python worker
1 parent 243c8f7 commit c23450b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dockerfiles/python.Dockerfile

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

56
# Install protobuf compiler
67
RUN apt-get update \
7-
&& DEBIAN_FRONTEND=noninteractive \
8+
&& DEBIAN_FRONTEND=noninteractive \
89
apt-get install --no-install-recommends --assume-yes \
9-
protobuf-compiler=3.12.4-1+deb11u1 libprotobuf-dev=3.12.4-1+deb11u1
10+
protobuf-compiler=3.12.4-1+deb11u1 libprotobuf-dev=3.12.4-1+deb11u1
1011

1112
# Get go compiler
1213
ARG TARGETARCH
@@ -20,7 +21,7 @@ RUN wget -q -O - https://sh.rustup.rs | sh -s -- -y
2021
ENV PATH="$PATH:/root/.cargo/bin"
2122

2223
# Install uv
23-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
24+
COPY --from=uv /uv /uvx /bin/
2425

2526
WORKDIR /app
2627

@@ -46,10 +47,14 @@ COPY workers/python ./workers/python
4647
# Build the worker
4748
RUN CGO_ENABLED=0 ./temporal-omes prepare-worker --language python --dir-name prepared --version "$SDK_VERSION"
4849

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

52-
COPY --from=build /bin/uv /bin/uv
57+
COPY --from=uv /uv /uvx /bin/
5358
COPY --from=build /app/temporal-omes /app/temporal-omes
5459
COPY --from=build /app/workers/python /app/workers/python
5560

0 commit comments

Comments
 (0)