Skip to content

Commit 80a29a4

Browse files
committed
Migrate pulumi-python image to match upstream with 3.13 as latest
1 parent 1e4a802 commit 80a29a4

2 files changed

Lines changed: 106 additions & 59 deletions

File tree

pulumi/pulumi-python/Containerfile

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,21 @@
11
# syntax=docker/dockerfile:1
22
# Arguments used in FROM need to be defined before the first build stage
3-
ARG BUILD_IMAGE=docker.io/ubuntu:noble-20250714
4-
ARG BASE_IMAGE=docker.io/polymathrobotics/python:3.9-noble
3+
ARG LANGUAGE_VERSION=3.13
4+
ARG BUILD_IMAGE=docker.io/ubuntu:noble-20250805
5+
ARG BASE_IMAGE=docker.io/polymathrobotics/python:${LANGUAGE_VERSION}-slim-noble
56
# hadolint ignore=DL3006
67
FROM $BUILD_IMAGE AS build
78

89
ARG PULUMI_VERSION
9-
ARG CINC_AUDITOR_URL_AMD64
10-
ARG CINC_AUDITOR_SHA256_AMD64
11-
ARG CINC_AUDITOR_URL_ARM64
12-
ARG CINC_AUDITOR_SHA256_ARM64
1310

1411
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1512
RUN <<EOF
1613
apt-get update
1714
apt-get install -y --no-install-recommends \
1815
ca-certificates \
19-
curl
20-
dpkgArch="$(dpkg --print-architecture)"
21-
case "${dpkgArch##*-}" in \
22-
amd64) \
23-
CINC_AUDITOR_URL="$CINC_AUDITOR_URL_AMD64" \
24-
CINC_AUDITOR_SHA256="$CINC_AUDITOR_SHA256_AMD64" \
25-
;; \
26-
arm64) \
27-
CINC_AUDITOR_URL="$CINC_AUDITOR_URL_ARM64" \
28-
CINC_AUDITOR_SHA256="$CINC_AUDITOR_SHA256_ARM64" \
29-
;; \
30-
*) echo "unsupported architecture"; exit 1 ;; \
31-
esac
32-
curl -fsSL -o /tmp/cinc-auditor.deb "${CINC_AUDITOR_URL}"
33-
echo "${CINC_AUDITOR_SHA256} /tmp/cinc-auditor.deb" | sha256sum -c -
16+
curl \
17+
build-essential \
18+
git
3419
EOF
3520

3621
# Install the Pulumi SDK, including the CLI and language runtimes.
@@ -42,41 +27,29 @@ RUN curl -fsSL https://get.pulumi.com/ | bash -s -- --version $PULUMI_VERSION
4227
# hadolint ignore=DL3006
4328
FROM $BASE_IMAGE
4429

45-
ENV PATH=/opt/cinc-auditor/bin:/opt/cinc-auditor/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
46-
47-
# Run the entire container with the default locale to be en_US.UTF-8
48-
RUN <<EOF
49-
apt-get update
50-
apt-get install -y --no-install-recommends locales
51-
locale-gen en_US.UTF-8
52-
update-locale LANG=en_US.UTF-8
53-
# The official Ubuntu images automatically run `apt-get clean`, so explicit
54-
# invocation is not required
55-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
56-
EOF
57-
58-
ENV LANG=en_US.UTF-8 \
59-
LANGUAGE=en_US:en \
60-
LC_ALL=en_US.UTF-8
61-
6230
WORKDIR /pulumi/projects
6331

64-
COPY --from=build /tmp/cinc-auditor.deb /tmp/cinc-auditor.deb
65-
66-
RUN --mount=type=cache,target=/var/lib/apt/list \
67-
--mount=type=cache,target=/var/cache/apt <<EOF
68-
apt-get update
69-
apt-get install -y --no-install-recommends /tmp/cinc-auditor.deb
70-
rm -rf /tmp/cinc-auditor.deb
32+
RUN <<EOF
33+
apt-get update -y
7134
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7235
ca-certificates \
36+
curl \
7337
git \
7438
vim
7539
EOF
7640

41+
# Install poetry
42+
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local/share/pypoetry python3 -
43+
RUN ln -s /usr/local/share/pypoetry/bin/poetry /usr/local/bin/
44+
45+
# Install uv
46+
RUN curl -LsSf https://astral.sh/uv/install.sh | XDG_BIN_HOME=/usr/local/share/uv bash -s -- --no-modify-path
47+
RUN ln -s /usr/local/share/uv/uv /usr/local/bin/
48+
RUN ln -s /usr/local/share/uv/uvx /usr/local/bin/
49+
7750
# Uses the workdir, copies from pulumi interim container
7851
COPY --from=build /root/.pulumi/bin/pulumi /pulumi/bin/pulumi
7952
COPY --from=build /root/.pulumi/bin/*-python* /pulumi/bin/
8053

8154
ENV PATH="/pulumi/bin:${PATH}"
82-
CMD ["pulumi"]
55+
CMD ["pulumi"]
Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,119 @@
11
variable "TAG_PREFIX" {
2-
default = "docker.io/polymathrobotics/pulumi-python"
2+
default = "docker.io/polymathrobotics"
33
}
44

55
variable "VERSION" {
6-
default = "3.186.0"
6+
default = "3.192.0"
7+
}
8+
9+
# Explicitly define the latest Python version used for the consolidated image
10+
variable "LATEST_PYTHON" {
11+
default = "3.13"
712
}
813

914
# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux
1015
variable "LOCAL_PLATFORM" {
1116
default = regex_replace("${BAKE_LOCAL_PLATFORM}", "^(darwin)", "linux")
1217
}
1318

19+
variable "IMAGES" {
20+
default = [
21+
"pulumi-python-3.9",
22+
"pulumi-python-3.10",
23+
"pulumi-python-3.11",
24+
"pulumi-python-3.12",
25+
"pulumi-python-3.13"
26+
]
27+
}
28+
1429
target "_common" {
1530
args = {
1631
PULUMI_VERSION = "${VERSION}"
17-
CINC_AUDITOR_URL_AMD64 = "https://ftp.osuosl.org/pub/cinc/files/stable/cinc-auditor/6.8.24/ubuntu/24.04/cinc-auditor_6.8.24-1_amd64.deb"
18-
CINC_AUDITOR_SHA256_AMD64 = "13907518ae88cc12d85fb09e2bca5c6f48d9ced75fe1dad61285d1d884cda9c7"
19-
CINC_AUDITOR_URL_ARM64 = "https://ftp.osuosl.org/pub/cinc/files/stable/cinc-auditor/6.8.24/ubuntu/24.04/cinc-auditor_6.8.24-1_arm64.deb"
20-
CINC_AUDITOR_SHA256_ARM64 = "7453d58358cc158ddfe7a92a4557966c1e4b472e207e6097cf2490b323bd2616"
2132
}
2233
dockerfile = "Containerfile"
23-
tags = [
24-
"${TAG_PREFIX}:${VERSION}",
25-
"${TAG_PREFIX}:latest"
26-
]
2734
labels = {
2835
"org.opencontainers.image.source" = "https://github.com/polymathrobotics/oci"
2936
"org.opencontainers.image.licenses" = "Apache-2.0"
3037
"org.opencontainers.image.description" = "Pulumi CLI container for python."
31-
"org.opencontainers.image.title" = "${TAG_PREFIX}"
38+
"org.opencontainers.image.title" = "${TAG_PREFIX}/pulumi-python"
3239
"org.opencontainers.image.created" = "${timestamp()}"
3340
"dev.polymathrobotics.image.readme-filepath" = "pulumi/README.md"
3441
}
3542
}
3643

37-
target "local" {
44+
target "local-matrix" {
45+
# replace `.` with `-` for the expanded image_name
46+
name = "local-${regex_replace("${image_name}", "\\.", "-")}"
3847
inherits = ["_common"]
48+
matrix = {
49+
image_name = IMAGES
50+
}
51+
platforms = ["${LOCAL_PLATFORM}"]
52+
tags = [
53+
"${TAG_PREFIX}/${image_name}:${VERSION}",
54+
"${TAG_PREFIX}/${image_name}:${VERSION}-noble",
55+
"${TAG_PREFIX}/${image_name}:latest"
56+
]
57+
args = {
58+
LANGUAGE_VERSION = "${regex_replace("${image_name}", "^.*-", "")}"
59+
}
60+
}
61+
62+
group "local" {
63+
targets = [
64+
"local-matrix", # all expanded matrix targets
65+
"local-pulumi-python-latest"
66+
]
67+
}
68+
69+
target "local-pulumi-python-latest" {
70+
inherits = ["_common"]
3971
platforms = ["${LOCAL_PLATFORM}"]
72+
tags = [
73+
"${TAG_PREFIX}/pulumi-python:${VERSION}",
74+
"${TAG_PREFIX}/pulumi-python:${VERSION}-noble",
75+
"${TAG_PREFIX}/pulumi-python:latest",
76+
]
77+
args = {
78+
LANGUAGE_VERSION = "${LATEST_PYTHON}"
79+
}
4080
}
4181

42-
target "default" {
82+
target "default-matrix" {
83+
# replace `.` with `-` for the expanded image_name
84+
name = "default-${regex_replace("${image_name}", "\\.", "-")}"
4385
inherits = ["_common"]
86+
matrix = {
87+
image_name = IMAGES
88+
}
89+
# target = image_name
90+
platforms = ["linux/amd64", "linux/arm64/v8"]
91+
tags = [
92+
"${TAG_PREFIX}/${image_name}:${VERSION}",
93+
"${TAG_PREFIX}/${image_name}:${VERSION}-noble",
94+
"${TAG_PREFIX}/${image_name}:latest"
95+
]
96+
args = {
97+
LANGUAGE_VERSION = "${regex_replace("${image_name}", "^.*-", "")}"
98+
}
99+
}
100+
101+
target "default-pulumi-python-latest" {
102+
inherits = ["_common"]
44103
platforms = ["linux/amd64", "linux/arm64/v8"]
104+
tags = [
105+
"${TAG_PREFIX}/pulumi-python:${VERSION}",
106+
"${TAG_PREFIX}/pulumi-python:${VERSION}-noble",
107+
"${TAG_PREFIX}/pulumi-python:latest",
108+
]
109+
args = {
110+
LANGUAGE_VERSION = "${LATEST_PYTHON}"
111+
}
45112
}
113+
114+
group "default" {
115+
targets = [
116+
"default-matrix", # all expanded matrix targets
117+
"default-pulumi-python-latest"
118+
]
119+
}

0 commit comments

Comments
 (0)