Skip to content

Commit

Permalink
Adjust Python image building
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 committed Feb 29, 2024
1 parent 69f8b14 commit 8072261
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 5 deletions.
16 changes: 15 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ updates:
include: "scope"

- package-ecosystem: "pip"
directory: "/components/runtimes/python39/kubeless"
directory: "/components/runtimes/python/python39"
labels:
- "area/dependency"
- "kind/chore"
Expand All @@ -82,6 +82,20 @@ updates:
opentelemetry:
patterns:
- "opentelemetry-*"
- package-ecosystem: "pip"
directory: "/components/runtimes/python/python312"
labels:
- "area/dependency"
- "kind/chore"
schedule:
interval: "weekly"
commit-message:
prefix: "pip-python312"
include: "scope"
groups:
opentelemetry:
patterns:
- "opentelemetry-*"

- package-ecosystem: "npm"
directory: "/components/runtimes/nodejs/nodejs16"
Expand Down
19 changes: 19 additions & 0 deletions components/runtimes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,22 @@ ifeq ($(JOB_TYPE), postsubmit)
else
@echo "Image signing skipped"
endif

## python312
FUNCTION_RUNTIME_IMAGE_PYTHON312 = function-runtime-python312
FUNCTION_RUNTIME_PYTHON312_IMG_NAME:=$(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(FUNCTION_RUNTIME_IMAGE_PYTHON312)

.PHONY: build-function-runtime-python312-image push-function-runtime-python312-image
build-function-runtime-python312-image:
docker build -t $(FUNCTION_RUNTIME_IMAGE_PYTHON312) $(ROOT)/python312/

push-function-runtime-python312-image:
docker tag $(FUNCTION_RUNTIME_IMAGE_PYTHON312) $(FUNCTION_RUNTIME_PYTHON312_IMG_NAME):$(DOCKER_TAG)
docker push $(FUNCTION_RUNTIME_PYTHON312_IMG_NAME):$(DOCKER_TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Sign image with Cosign"
cosign version
cosign sign -key ${KMS_KEY_URL} $(FUNCTION_RUNTIME_PYTHON312_IMG_NAME):$(DOCKER_TAG)
else
@echo "Image signing skipped"
endif
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions components/runtimes/python/python312/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.12.2-alpine3.19

# Serverless
LABEL source = git@github.com:kyma-project/kyma.git

# build-base and linux-headers are needed to install all requirements
RUN apk add --no-cache --virtual .build-deps build-base linux-headers

COPY ./python312/requirements.txt /kubeless/requirements.txt

RUN pip install --no-cache-dir -r /kubeless/requirements.txt

COPY ./kubeless/ /

WORKDIR /

USER 1000
# Tracing propagators are configured based on OTEL_PROPAGATORS env variable https://opentelemetry.io/docs/instrumentation/python/manual/#using-environment-variables
ENV OTEL_PROPAGATORS=tracecontext,baggage,b3multi
ENV OTEL_PYTHON_REQUESTS_EXCLUDED_URLS="healthz,favicon.ico,metrics"

CMD ["python", "/kubeless.py"]
1 change: 1 addition & 0 deletions components/runtimes/python/python39/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubeless/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ LABEL source = git@github.com:kyma-project/kyma.git
# build-base and linux-headers are needed to install all requirements
RUN apk add --no-cache --virtual .build-deps build-base linux-headers

COPY kubeless/requirements.txt /kubeless/requirements.txt
COPY ./python39/requirements.txt /kubeless/requirements.txt

RUN pip install --no-cache-dir -r /kubeless/requirements.txt

COPY kubeless/ /
COPY ./kubeless/ /

WORKDIR /

Expand Down
12 changes: 12 additions & 0 deletions components/runtimes/python/python39/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
setuptools==69.1.1
requests>=2.31.0
bottle==0.12.25
cheroot==10.0.0
wsgi-request-logger==0.4.6
prometheus_client==0.20.0
opentelemetry-api==1.23.0
opentelemetry-sdk==1.23.0
opentelemetry-exporter-otlp-proto-http==1.23.0
opentelemetry-propagator-b3==1.23.0
opentelemetry-instrumentation-requests==0.44b0
cloudevents
10 changes: 8 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@ services:
image: europe-docker.pkg.dev/kyma-project/dev/function-runtime-python39:local
platform: "linux/amd64"
build:
context: components/runtimes/python39
dockerfile: Dockerfile
context: components/runtimes/python/python39
dockerfile: Dockerfile
function_runtime_python312:
image: europe-docker.pkg.dev/kyma-project/dev/function-runtime-python312:local
platform: "linux/amd64"
build:
context: components/runtimes/python/python312
dockerfile: Dockerfile

0 comments on commit 8072261

Please sign in to comment.