From c3bd39997d0df5392a50243719ce375da00551a9 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 24 May 2025 15:03:00 +0300
Subject: [PATCH] A few updates.

- Update the base image for most images.
- Remove the Cloudposse repo for the k8s image. All of the tools are now
  available in the Alpine repos.
- Use the toolbx image as the base image for the python3 image.
- Use the python3 image as the base for the pre-commit image.
---
 .gitlab-ci.yml               |  2 ++
 images/bats/Dockerfile       |  2 +-
 images/docker/Dockerfile     |  2 +-
 images/hugo/Dockerfile       |  2 +-
 images/k8s/Dockerfile        |  5 ++---
 images/pre-commit/Dockerfile | 13 ++-----------
 images/python3/Dockerfile    |  7 +++++--
 7 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 745d808..b762d7b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -110,6 +110,8 @@ push-k8s:
 # pre-commit image:
 
 build-pre-commit:
+  needs:
+    - push-python3
   extends: .container-build
   variables:
     CONTEXT: images/pre-commit
diff --git a/images/bats/Dockerfile b/images/bats/Dockerfile
index 33718a2..c9656ab 100644
--- a/images/bats/Dockerfile
+++ b/images/bats/Dockerfile
@@ -1,4 +1,4 @@
-FROM registry.hub.docker.com/library/alpine:3.18
+FROM registry.hub.docker.com/library/alpine:3.21
 # hadolint ignore=DL3018
 RUN apk add --update --no-cache \
         bats \
diff --git a/images/docker/Dockerfile b/images/docker/Dockerfile
index 03c9b40..79d93f8 100644
--- a/images/docker/Dockerfile
+++ b/images/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.io/docker:24.0-cli
+FROM docker.io/docker:28.0-cli
 # hadolint ignore=DL3018
 RUN apk add --update-cache --no-cache \
         buildah \
diff --git a/images/hugo/Dockerfile b/images/hugo/Dockerfile
index 3a11a2b..43a2e69 100644
--- a/images/hugo/Dockerfile
+++ b/images/hugo/Dockerfile
@@ -1,4 +1,4 @@
-FROM registry.hub.docker.com/library/alpine:3.18
+FROM registry.hub.docker.com/library/alpine:3.21
 # hadolint ignore=DL3018
 RUN apk add --no-cache --update hugo && \
     hugo version
diff --git a/images/k8s/Dockerfile b/images/k8s/Dockerfile
index bd30cf4..69bc5f1 100644
--- a/images/k8s/Dockerfile
+++ b/images/k8s/Dockerfile
@@ -1,7 +1,6 @@
-FROM docker.io/library/alpine:3.18
+FROM docker.io/library/alpine:3.21
 # hadolint ignore=DL3018
-RUN wget -q https://apk.cloudposse.com/ops@cloudposse.com.rsa.pub -O /etc/apk/keys/ops@cloudposse.com.rsa.pub && \
-    echo "https://apk.cloudposse.com/3.15/vendor" >> /etc/apk/repositories && \
+RUN echo '@community https://dl-cdn.alpinelinux.org/alpine/v3.21/community' >> /etc/apk/repositories && \
     apk add --update --no-cache \
         docker-cli \
         helm \
diff --git a/images/pre-commit/Dockerfile b/images/pre-commit/Dockerfile
index dfb144f..6953960 100644
--- a/images/pre-commit/Dockerfile
+++ b/images/pre-commit/Dockerfile
@@ -1,5 +1,5 @@
 # hadolint ignore=DL3007
-FROM registry.shore.co.il/toolbx:latest
+FROM registry.shore.co.il/ci-images:python3
 SHELL ["/bin/bash", "-o", "pipefail", "-c"]
 # hadolint ignore=DL3008,DL3013
 RUN apt-get update && \
@@ -7,18 +7,9 @@ RUN apt-get update && \
         docker-ce-cli \
         docker-compose-plugin \
         git \
-        python3-dev \
-        python3-pip \
-        python3-setuptools \
-        python3-venv \
     && \
     ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose && \
-    export PIP_CONSTRAINT=/tmp/constraint.txt && \
-    echo 'Cython < 3.0' > "$PIP_CONSTRAINT" && \
-    python3 -m pip install --no-cache-dir --break-system-packages \
-        pipenv \
-        poetry \
+    python3 -m pip install --no-cache-dir \
         pre_commit \
-        tox \
     && \
     rm -rf /root/.cache /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
diff --git a/images/python3/Dockerfile b/images/python3/Dockerfile
index 758e477..f1a0d43 100644
--- a/images/python3/Dockerfile
+++ b/images/python3/Dockerfile
@@ -1,12 +1,15 @@
-FROM buildpack-deps:bookworm
+# hadolint ignore=DL3007
+FROM registry.shore.co.il/toolbx:latest
 # hadolint ignore=DL3008,DL3013
 RUN apt-get update && \
     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+        build-essential \
         python3-dev \
         python3-pip \
         python3-venv \
     && \
-    python3 -m pip install --progress-bar=off --no-cache-dir --upgrade --break-system-packages \
+    rm /usr/lib/python*/EXTERNALLY-MANAGED && \
+    python3 -m pip install --progress-bar=off --no-cache-dir --upgrade \
         pipenv \
         poetry \
         tox \
-- 
GitLab