Skip to content

Commit c35fe29

Browse files
Support set python version when build python runner image (#784)
* Support set python version when build python runner image * Update ci
1 parent de6bfed commit c35fe29

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

.ci/tests/integration-oauth2/e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup:
66
- name: build images
77
command: |
88
chmod +x images/build.sh images/samples/build.sh
9-
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform KIND_PUSH=true images/build.sh
9+
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform PYTHON_VERSION=3.10 KIND_PUSH=true images/build.sh
1010
PULSAR_IMAGE_TAG=3.2.2.1 KIND_PUSH=true images/samples/build.sh
1111
1212
- name: install helm

.ci/tests/integration-oauth2/e2e_with_downloader.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup:
66
- name: build images
77
command: |
88
chmod +x images/build.sh images/samples/build.sh
9-
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform KIND_PUSH=true images/build.sh
9+
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform PYTHON_VERSION=3.9 KIND_PUSH=true images/build.sh
1010
PULSAR_IMAGE_TAG=3.2.2.1 KIND_PUSH=true images/samples/build.sh
1111
1212
- name: install helm

.ci/tests/integration/e2e_with_tls.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup:
66
- name: build images
77
command: |
88
chmod +x images/build.sh images/samples/build.sh
9-
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform KIND_PUSH=true images/build.sh
9+
PULSAR_IMAGE_TAG=3.2.2.1 PULSAR_IMAGE=streamnative/sn-platform PYTHON_VERSION=3.11 KIND_PUSH=true images/build.sh
1010
PULSAR_IMAGE_TAG=3.2.2.1 KIND_PUSH=true images/samples/build.sh
1111
1212
- name: install helm

images/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ set -e
2121

2222
PULSAR_IMAGE=${PULSAR_IMAGE:-"streamnative/sn-platform"}
2323
PULSAR_IMAGE_TAG=${PULSAR_IMAGE_TAG:-"2.7.1"}
24+
PYTHON_VERSION=${PYTHON_VERSION:-"3.12"}
2425
DOCKER_REPO=${DOCKER_REPO:-"streamnative"}
2526
RUNNER_BASE="pulsar-functions-runner-base"
2627
PULSARCTL_RUNNER_BASE="pulsar-functions-pulsarctl-runner-base"
@@ -48,7 +49,7 @@ docker tag ${PULSARCTL_JAVA_RUNNER} "${DOCKER_REPO}"/${PULSARCTL_JAVA_RUNNER}:"$
4849

4950
echo "build python runner"
5051
docker build --platform linux/amd64 -t ${PYTHON_RUNNER} images/pulsar-functions-python-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
51-
docker build --platform linux/amd64 -t ${PULSARCTL_PYTHON_RUNNER} images/pulsar-functions-python-runner -f images/pulsar-functions-python-runner/pulsarctl.Dockerfile --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
52+
docker build --platform linux/amd64 -t ${PULSARCTL_PYTHON_RUNNER} images/pulsar-functions-python-runner -f images/pulsar-functions-python-runner/pulsarctl.Dockerfile --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --build-arg PYTHON_VERSION="$PYTHON_VERSION" --progress=plain
5253
docker tag ${PYTHON_RUNNER} "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}"
5354
docker tag ${PULSARCTL_PYTHON_RUNNER} "${DOCKER_REPO}"/${PULSARCTL_PYTHON_RUNNER}:"${RUNNER_TAG}"
5455

images/pulsar-functions-python-runner/pulsarctl.Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
ARG PULSAR_IMAGE
22
ARG PULSAR_IMAGE_TAG
3+
ARG PYTHON_VERSION=3.12
34
FROM ${PULSAR_IMAGE}:${PULSAR_IMAGE_TAG} as pulsar
4-
FROM pulsar-functions-pulsarctl-runner-base:latest
5+
6+
FROM python:${PYTHON_VERSION}-alpine
7+
8+
ENV GID=10001
9+
ENV UID=10000
10+
ENV USER=pulsar
11+
RUN addgroup -g $GID pulsar
12+
RUN adduser -u $UID -G pulsar -D -g '' $USER
13+
14+
RUN mkdir -p /pulsar/bin/ \
15+
&& mkdir -p /pulsar/lib/ \
16+
&& mkdir -p /pulsar/conf/ \
17+
&& mkdir -p /pulsar/instances/ \
18+
&& mkdir -p /pulsar/connectors/ \
19+
&& mkdir -p /pulsar/logs/ \
20+
&& mkdir -p /pulsar/tmp/ \
21+
&& mkdir -p /pulsar/examples/ \
22+
&& chown -R $UID:$GID /pulsar \
23+
&& chmod -R g=u /pulsar \
24+
&& apk update && apk add --no-cache wget bash \
25+
&& wget https://github.com/streamnative/pulsarctl/releases/latest/download/pulsarctl-amd64-linux.tar.gz -P /pulsar/bin/ \
26+
&& tar -xzf /pulsar/bin/pulsarctl-amd64-linux.tar.gz -C /pulsar/bin/ \
27+
&& rm -rf /pulsar/bin/pulsarctl-amd64-linux.tar.gz \
28+
&& chmod +x /pulsar/bin/pulsarctl-amd64-linux/pulsarctl \
29+
&& ln -s /pulsar/bin/pulsarctl-amd64-linux/pulsarctl /usr/local/bin/pulsarctl
30+
31+
WORKDIR /pulsar
532

633
COPY --from=pulsar --chown=$UID:$GID /pulsar/bin /pulsar/bin
734
COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/python-instance /pulsar/instances/python-instance
@@ -20,7 +47,7 @@ ENV PULSAR_CLIENT_PYTHON_VERSION=3.5.0
2047
COPY --from=pulsar --chown=$UID:$GID /pulsar/README /pulsar/cpp-clien* /pulsar/cpp-client/
2148

2249
RUN apk update \
23-
&& apk add --no-cache python3 python3-dev tk-dev curl ca-certificates\
50+
&& apk add --no-cache tk-dev curl ca-certificates\
2451
&& mkdir -p /etc/pki/tls/certs && cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt \
2552
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
2653
&& mv /usr/lib/python3.*/EXTERNALLY-MANAGED /tmp/EXTERNALLY-MANAGED.old \

0 commit comments

Comments
 (0)