Skip to content

Commit 2ca55c8

Browse files
authored
Pick up ca-certificates 20250419+deb13u1 and remove what the image doesn't use (#323)
* Pick up ca-certificates 20250419+deb13u1 and castore 1.0.22 Moving the base to trixie-20261005-slim rebuilds the cached layer that installs ca-certificates, so it gets 20250419+deb13u1 (DSA-6572-1). AWS_CA_BUNDLE makes awscli use the system's CA bundle instead of the one it ships. * Remove what the image installs and nothing runs Nothing has called gcloud or gsutil since the docs scripts were removed in e70a235, so google-cloud-cli goes, with gnupg and apt-transport-https, which were only there to install it, and etc/boto, which only gsutil read. The key file cosign signs with moves from /boto to /gcp. build-essential, libffi-dev, libssl-dev and python3-dev were for pip install awscli, and awscli is the Debian package now. No job script runs zip, and tar and gzip are part of the base image. In the build stage, no dependency is a git checkout or compiles C, so git and build-essential go too. utils.sh lost its last caller in e70a235, and the prepare_*_builds_text.exs scripts rebuilt builds.txt from S3 listings, which Bob.Artifacts generates from the database now.
1 parent cf09b9f commit 2ca55c8

8 files changed

Lines changed: 13 additions & 153 deletions

File tree

‎Dockerfile‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG ELIXIR_VERSION=1.20.4
22
ARG ERLANG_VERSION=29.1.1
3-
ARG DEBIAN_VERSION=trixie-20260918-slim
3+
ARG DEBIAN_VERSION=trixie-20261005-slim
44

55
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-debian-${DEBIAN_VERSION} AS build
66

@@ -9,7 +9,7 @@ ENV LANG=C.UTF-8
99
# install build dependencies
1010
RUN apt update -y && \
1111
apt upgrade -y && \
12-
apt install -y --no-install-recommends git build-essential ca-certificates && \
12+
apt install -y --no-install-recommends ca-certificates && \
1313
apt clean -y && rm -rf /var/lib/apt/lists/*
1414

1515
# prepare build dir
@@ -61,7 +61,7 @@ FROM debian:${DEBIAN_VERSION} AS app
6161

6262
# Erlang/OTP loads libsctp.so.1 when it starts and prints a warning without it
6363
RUN apt update -y && \
64-
apt install --no-install-recommends -y apt-transport-https awscli bash build-essential ca-certificates coreutils curl docker-cli gnupg gzip libffi-dev libsctp1 libssl-dev openssl python3-dev tar zip && \
64+
apt install --no-install-recommends -y awscli bash ca-certificates coreutils curl docker-cli libsctp1 openssl && \
6565
apt clean -y && rm -rf /var/lib/apt/lists/*
6666

6767
ARG BUILDX_VERSION=0.17.1
@@ -72,15 +72,9 @@ RUN mkdir -p /usr/libexec/docker/cli-plugins && \
7272

7373
COPY --from=ghcr.io/sigstore/cosign/cosign:v3.1.3@sha256:9e5c2f2edc34351160407ca3416c61855bdf9403c3c5936e0f0be7fc261611b8 /ko-app/cosign /usr/local/bin/cosign
7474

75-
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
76-
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
77-
apt update -y && apt install --no-install-recommends -y google-cloud-cli && \
78-
apt clean -y && rm -rf /var/lib/apt/lists/*
79-
8075
# The release creates /app/tmp when it starts and writes its runtime config
8176
# there, so /app is nobody's.
82-
RUN mkdir /app /boto /persist && chown nobody:nogroup /app /boto /persist
83-
COPY --chown=65534:65534 etc/boto /app/.boto
77+
RUN mkdir /app /gcp /persist && chown nobody:nogroup /app /gcp /persist
8478

8579
WORKDIR /app
8680

@@ -92,6 +86,9 @@ USER nobody
9286

9387
ENV HOME=/app
9488
ENV LANG=C.UTF-8
89+
# awscli verifies servers against the CA bundle it ships with unless this
90+
# points it at another one
91+
ENV AWS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
9592
# Declared here, in the last stage, so a new commit does not invalidate the
9693
# build cache for everything above it. PromEx reads these to report which
9794
# revision is running.

‎etc/boto‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎lib/bob/application.ex‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Bob.Application do
66
BobWeb.BanditTelemetry.attach()
77

88
setup_docker()
9-
setup_gsutil()
9+
setup_gcp_credentials()
1010
auth_docker()
1111
validate_jobs()
1212

@@ -77,11 +77,11 @@ defmodule Bob.Application do
7777
end
7878
end
7979

80-
defp setup_gsutil() do
80+
defp setup_gcp_credentials() do
8181
if credentials = System.get_env("BOB_GCP_CREDENTIALS") do
8282
credentials = fix_env_newlines(credentials)
83-
File.mkdir_p!("/boto")
84-
File.write!("/boto/keyfile.json", credentials)
83+
File.mkdir_p!("/gcp")
84+
File.write!("/gcp/keyfile.json", credentials)
8585
end
8686
end
8787

‎mix.lock‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%{
22
"bandit": {:hex, :bandit, "1.12.5", "af205a8e550f304caae09a97d29fd3c79a7f337526ea7cd772d2ff11d2f7c800", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.5", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "c5684ca062fa407cac115aec3256383f3e2ec9fdced7904d59cf5a7bb7ed6181"},
3-
"castore": {:hex, :castore, "1.0.21", "0a0e8330dc267a40a3b7ad86d39302764bb71758172904e6a59d5ad6443ce307", [:mix], [], "hexpm", "e42e22723e25dbd46876d056a03f685513d6e98f6b5e555dc551321decd76c5c"},
3+
"castore": {:hex, :castore, "1.0.22", "a01978e6a5d42fa3a34143630588f92036e7d90e2309ecdd466722d1279a2213", [:mix], [], "hexpm", "c2a4d42723b4affbc1c3e15d8f6df3f7d8f1f627c84de643383634cce58493d5"},
44
"cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"},
55
"circular_buffer": {:hex, :circular_buffer, "1.1.0", "af9332c40d600cc27b160eebd9fad1bf0a8106cd62e9f57d6cc8f028d3cc46d1", [:mix], [], "hexpm", "0daa0a4fcb3a7ffabc8576bdbf64c99adc6d4b37eab1185179140769ba58f571"},
66
"db_connection": {:hex, :db_connection, "2.10.2", "ae391e803a5adff104da913c2fc1c0c14a37f8b10001dcef568796e1fb7bf95c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "510b14482330f1af6490a2fa0efd8d4f1435d1529b165647df22ac0f2df0fa93"},

‎priv/scripts/docker/sign.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tag=$2
99
digest=sha256:$(docker buildx imagetools inspect --raw ${repo}:${tag} | sha256sum | cut -d ' ' -f 1)
1010

1111
# Cloud KMS is called as the service account whose key Bob.Application writes here
12-
export GOOGLE_APPLICATION_CREDENTIALS=/boto/keyfile.json
12+
export GOOGLE_APPLICATION_CREDENTIALS=/gcp/keyfile.json
1313

1414
# This command has a tendency to intermittently fail
1515
cosign sign --yes --key ${BOB_COSIGN_KEY} ${repo}@${digest} ||

‎priv/scripts/prepare_elixir_builds_text.exs‎

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎priv/scripts/prepare_otp_builds_text.exs‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

‎priv/scripts/utils.sh‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)