Skip to content

Commit 73ab353

Browse files
aarthy-dkclaude
andcommitted
ci: harden container images and bump Python to 3.13
Remove curl/libcurl from runtime image (unused), bump Python 3.12 to 3.13 to resolve CPE CVEs, and upgrade confluent-kafka, msgpack, and peewee for 3.13 compatibility. OBS-1999 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8206e45 commit 73ab353

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

deploy/docker/observability-be.dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DEV NOTE: YOU MUST RUN `docker build` FROM THE TOP-LEVEL OF `observability-be` AND POINT TO THIS FILE.
22
ARG BASE_IMAGE_URL
3-
FROM ${BASE_IMAGE_URL}python:3.12.13-alpine3.23 AS build-image
3+
FROM ${BASE_IMAGE_URL}python:3.13-alpine3.23 AS build-image
44
LABEL maintainer="DataKitchen"
55

66
RUN apk update && apk upgrade && apk add --no-cache \
@@ -21,7 +21,7 @@ RUN python3 -O -m pip install /tmp/dk --prefix=/dk
2121

2222
# Copy and build the actual application
2323
COPY . /tmp/dk/
24-
ENV PYTHONPATH=/dk/lib/python3.12/site-packages
24+
ENV PYTHONPATH=/dk/lib/python3.13/site-packages
2525
# --no-deps: The previous pip layer will have already installed the dependencies. This
2626
# will disable doing a second dependency resolution check.
2727
# -O: Strips asserts from the code which removes some unnecessary codepaths resulting in a small
@@ -30,9 +30,10 @@ ENV PYTHONPATH=/dk/lib/python3.12/site-packages
3030
# --prefix=/dk: The destination installation environment folder
3131
RUN python3 -O -m pip install --no-deps /tmp/dk --prefix=/dk
3232

33-
FROM ${BASE_IMAGE_URL}python:3.12.13-alpine3.23 AS runtime-image
33+
FROM ${BASE_IMAGE_URL}python:3.13-alpine3.23 AS runtime-image
3434

3535
RUN apk update && apk upgrade && apk add --no-cache librdkafka=2.12.1-r0 \
36+
&& apk del curl libcurl \
3637
&& pip install --no-cache-dir --upgrade pip
3738

3839
# Grab the pre-built app from the build-image. This way we don't have
@@ -47,7 +48,7 @@ COPY --from=build-image \
4748

4849
COPY --from=build-image /tmp/dk/deploy/migrations/ /dk/lib/migrations/
4950

50-
ENV PYTHONPATH=/dk/lib/python3.12/site-packages
51+
ENV PYTHONPATH=/dk/lib/python3.13/site-packages
5152
ENV PATH=${PATH}:/dk/bin
5253

5354
RUN addgroup -S observability && adduser -S observability -G observability

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ classifiers = [
1414
"Intended Audience :: Developers",
1515
"Operating System :: OS Independent",
1616
"Programming Language :: Python",
17-
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.13",
1818
]
19-
requires-python = ">=3.12"
19+
requires-python = ">=3.13"
2020

2121
dependencies = [
2222
"arrow~=1.2.2",
@@ -25,17 +25,17 @@ dependencies = [
2525
"APScheduler~=3.10.0",
2626
"blinker~=1.9.0",
2727
"boltons~=23.0.0",
28-
"confluent-kafka==2.4.0",
28+
"confluent-kafka~=2.6.0",
2929
"cryptography~=46.0.5",
3030
"flask~=3.1.0",
3131
"gunicorn~=23.0.0",
3232
"log-color==2.0.0",
3333
"Marshmallow-Peewee~=3.4.3",
3434
"marshmallow~=3.26.2",
3535
"marshmallow-union==0.1.15.post1",
36-
"msgpack==1.0.4",
36+
"msgpack~=1.1.0",
3737
"oauthlib~=3.2",
38-
"peewee~=3.16.0",
38+
"peewee~=3.17.0",
3939
"PyJWT~=2.4",
4040
"PyMySQL==1.1.1",
4141
"pybars3~=0.9.7",
@@ -122,7 +122,7 @@ filterwarnings = [
122122
# for an explanation of their functionality.
123123
# WARNING: When changing mypy configurations, be sure to test them after removing your .mypy_cache
124124
[tool.mypy]
125-
python_version = "3.12"
125+
python_version = "3.13"
126126
check_untyped_defs = true
127127
disallow_untyped_decorators = true
128128
disallow_untyped_defs = true
@@ -249,7 +249,7 @@ module = "pybars"
249249
ignore_missing_imports = true
250250

251251
[tool.ruff]
252-
target-version = "py310"
252+
target-version = "py313"
253253
line-length = 120
254254

255255
[tool.ruff.lint]

0 commit comments

Comments
 (0)