Skip to content

Commit b0cc414

Browse files
feat: switch to Alpine base image and update package installation
1 parent c6358a3 commit b0cc414

6 files changed

Lines changed: 44 additions & 27 deletions

File tree

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
!README.md
88
!entrypoint.sh
99
!terraform-copy-vars.py
10-
!pip
10+
!alpine-packages.txt

Dockerfile

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
FROM ubuntu:questing-20251217
2-
3-
# Disable interactive mode
4-
ENV DEBIAN_FRONTEND=noninteractive
1+
FROM alpine:3.23.4
52

63
# Copy all needed files
74
COPY terraform-copy-vars.py entrypoint.sh /
5+
COPY alpine-packages.txt /tmp/alpine-packages.txt
86

97
# Install needed packages
10-
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
11-
# hadolint ignore=DL3008
12-
RUN chmod +x /entrypoint.sh ;\
13-
apt-get update -y ;\
14-
apt-get install --no-install-recommends -y \
15-
bash \
16-
git \
17-
python3 \
18-
python3-pip ;\
19-
apt-get clean ;\
20-
rm -rf /var/lib/apt/lists/*
8+
SHELL ["/bin/sh", "-euxo", "pipefail", "-c"]
9+
# hadolint ignore=DL3018
10+
RUN set -eux; \
11+
xargs -r apk add --no-cache < /tmp/alpine-packages.txt; \
12+
chmod +x /entrypoint.sh; \
13+
python3 --version; \
14+
pip3 --version; \
15+
git --version; \
16+
rm -rf /var/cache/*; \
17+
rm -rf /root/.cache/*; \
18+
rm -rf /tmp/*
2119

2220
# Finish up
2321
CMD ["python3", "--version"]

Taskfile.cicd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ tasks:
6060
- task: scripts:lint:yamllint
6161

6262
dependency:update:
63-
desc: 'No-op: no dedicated dependency updater configured for this profile'
63+
desc: Update repository dependencies not covered by Dependabot
6464
cmds:
65-
- task: scripts:dependency:update
65+
- task: scripts:packages:update
6666

6767
version:set:
6868
desc: Update version in README.md and action.yml

Taskfile.scripts.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,9 @@ tasks:
107107
fi
108108
109109
dependency:update:
110-
desc: 'No-op: no dedicated dependency updater configured for this profile'
110+
desc: Update dependency metadata for this repository
111111
cmds:
112-
- |
113-
echo "INFO: No dedicated dependency updater configured for this repository profile."
114-
echo "INFO: Dependabot handles GitHub Actions and package metadata updates."
115-
echo "INFO: Keep this task as a safe no-op until a repo-specific dependency updater is defined."
112+
- task: packages:update
116113

117114
version:get:
118115
desc: Get current version
@@ -287,7 +284,22 @@ tasks:
287284
exit 0
288285
fi
289286
290-
base_image="$(sed -nE 's/^FROM[[:space:]]+([^[:space:]]+).*/\1/p' Dockerfile | head -1)"
287+
base_image="$(awk '
288+
toupper($1) == "FROM" {
289+
i = 2
290+
while (i <= NF && $i ~ /^--/) {
291+
i++
292+
}
293+
if (i <= NF) {
294+
image = $i
295+
}
296+
}
297+
END {
298+
if (image != "") {
299+
print image
300+
}
301+
}
302+
' Dockerfile)"
291303
if [ -z "$base_image" ]; then
292304
echo "INFO: Could not resolve base image; nothing to update"
293305
exit 0

alpine-packages.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bash~=5.3
2+
git~=2.52
3+
python3~=3.12
4+
py3-pip~=25.1

tests/docker/local-image.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ commandTests:
44
- name: OS version check
55
command: cat
66
args: [/etc/os-release]
7-
expectedOutput: [VERSION_ID="25\.10"]
7+
expectedOutput: [VERSION_ID=3\.23]
88

99
- name: Required tools installed
1010
command: bash
1111
args:
1212
- -lc
1313
- command -v bash >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1 && command -v pip3 >/dev/null 2>&1 && command -v git >/dev/null 2>&1
1414

15-
- name: Apt cache cleaned
15+
- name: Temporary and APK cache cleaned
1616
command: bash
1717
args:
1818
- -lc
19-
- test ! -d /var/lib/apt/lists || test -z "$(find /var/lib/apt/lists -mindepth 1 -maxdepth 1 2>/dev/null)"
19+
- >-
20+
test ! -f /tmp/alpine-packages.txt &&
21+
(test ! -d /var/cache/apk || test -z "$(find /var/cache/apk -mindepth 1 -maxdepth 1 2>/dev/null)") &&
22+
(test ! -d /root/.cache || test -z "$(find /root/.cache -mindepth 1 -maxdepth 1 2>/dev/null)")
2023
2124
fileExistenceTests:
2225
- name: entrypoint exists

0 commit comments

Comments
 (0)