From 7f078b1b01338e19130eb8b01cb7f35153ba6b04 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 7 Jan 2025 16:22:15 -0800 Subject: [PATCH] Remove runtime dependencies from slim and alpine variants These were never intended to be part of the "interface" of the `slim` and `alpine` images -- they were included before we had fancy `ldd`/`scanelf`-based runtime dependency inclusion, and were a metapackage that helped us avoid the complexity of `libyaml3` vs `libyaml4` (and making sure we install the correct one). This moves them to explicit build-time dependencies accordingly, as they should've always been. --- 3.1/alpine3.20/Dockerfile | 14 +++----------- 3.1/alpine3.21/Dockerfile | 14 +++----------- 3.1/slim-bookworm/Dockerfile | 13 ++++++------- 3.1/slim-bullseye/Dockerfile | 13 ++++++------- 3.2/alpine3.20/Dockerfile | 14 +++----------- 3.2/alpine3.21/Dockerfile | 14 +++----------- 3.2/slim-bookworm/Dockerfile | 13 ++++++------- 3.2/slim-bullseye/Dockerfile | 13 ++++++------- 3.3/alpine3.20/Dockerfile | 14 +++----------- 3.3/alpine3.21/Dockerfile | 14 +++----------- 3.3/slim-bookworm/Dockerfile | 13 ++++++------- 3.3/slim-bullseye/Dockerfile | 13 ++++++------- 3.4/alpine3.20/Dockerfile | 14 +++----------- 3.4/alpine3.21/Dockerfile | 14 +++----------- 3.4/slim-bookworm/Dockerfile | 13 ++++++------- 3.4/slim-bullseye/Dockerfile | 13 ++++++------- Dockerfile.template | 30 ++++++++++-------------------- 17 files changed, 82 insertions(+), 164 deletions(-) diff --git a/3.1/alpine3.20/Dockerfile b/3.1/alpine3.20/Dockerfile index f04177227..c24521655 100644 --- a/3.1/alpine3.20/Dockerfile +++ b/3.1/alpine3.20/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.20 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -45,6 +34,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -56,6 +46,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ readline-dev \ ruby \ tar \ diff --git a/3.1/alpine3.21/Dockerfile b/3.1/alpine3.21/Dockerfile index 81fe32a00..008205481 100644 --- a/3.1/alpine3.21/Dockerfile +++ b/3.1/alpine3.21/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.21 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -45,6 +34,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -56,6 +46,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ readline-dev \ ruby \ tar \ diff --git a/3.1/slim-bookworm/Dockerfile b/3.1/slim-bookworm/Dockerfile index eb96f931b..0ca7f68ca 100644 --- a/3.1/slim-bookworm/Dockerfile +++ b/3.1/slim-bookworm/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bookworm-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -44,18 +37,24 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.1/slim-bullseye/Dockerfile b/3.1/slim-bullseye/Dockerfile index 3d51740b9..e0cfccd50 100644 --- a/3.1/slim-bullseye/Dockerfile +++ b/3.1/slim-bullseye/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bullseye-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -44,18 +37,24 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.2/alpine3.20/Dockerfile b/3.2/alpine3.20/Dockerfile index 30919ed40..ce2f4483f 100644 --- a/3.2/alpine3.20/Dockerfile +++ b/3.2/alpine3.20/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.20 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -45,6 +34,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -56,6 +46,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ readline-dev \ ruby \ tar \ diff --git a/3.2/alpine3.21/Dockerfile b/3.2/alpine3.21/Dockerfile index 1c1b1a8ba..17f0a3aed 100644 --- a/3.2/alpine3.21/Dockerfile +++ b/3.2/alpine3.21/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.21 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -45,6 +34,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -56,6 +46,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ readline-dev \ ruby \ tar \ diff --git a/3.2/slim-bookworm/Dockerfile b/3.2/slim-bookworm/Dockerfile index 7142b0f35..43106aaf5 100644 --- a/3.2/slim-bookworm/Dockerfile +++ b/3.2/slim-bookworm/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bookworm-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -44,18 +37,24 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.2/slim-bullseye/Dockerfile b/3.2/slim-bullseye/Dockerfile index 8d278ff26..c2608ee5b 100644 --- a/3.2/slim-bullseye/Dockerfile +++ b/3.2/slim-bullseye/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bullseye-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -44,18 +37,24 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.3/alpine3.20/Dockerfile b/3.3/alpine3.20/Dockerfile index 4fdc15b5e..60fe9edc9 100644 --- a/3.3/alpine3.20/Dockerfile +++ b/3.3/alpine3.20/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.20 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -44,6 +33,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -55,6 +45,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ ruby \ tar \ xz \ diff --git a/3.3/alpine3.21/Dockerfile b/3.3/alpine3.21/Dockerfile index a12746bb9..45f40fd99 100644 --- a/3.3/alpine3.21/Dockerfile +++ b/3.3/alpine3.21/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.21 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -44,6 +33,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -55,6 +45,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ ruby \ tar \ xz \ diff --git a/3.3/slim-bookworm/Dockerfile b/3.3/slim-bookworm/Dockerfile index 6730cf491..0b785c50c 100644 --- a/3.3/slim-bookworm/Dockerfile +++ b/3.3/slim-bookworm/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bookworm-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -43,17 +36,23 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.3/slim-bullseye/Dockerfile b/3.3/slim-bullseye/Dockerfile index d68cc7a2b..3efa48c8b 100644 --- a/3.3/slim-bullseye/Dockerfile +++ b/3.3/slim-bullseye/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bullseye-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -43,17 +36,23 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.4/alpine3.20/Dockerfile b/3.4/alpine3.20/Dockerfile index ff0e3a296..535373b75 100644 --- a/3.4/alpine3.20/Dockerfile +++ b/3.4/alpine3.20/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.20 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -44,6 +33,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -55,6 +45,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ ruby \ tar \ xz \ diff --git a/3.4/alpine3.21/Dockerfile b/3.4/alpine3.21/Dockerfile index 826e727fb..714021fbb 100644 --- a/3.4/alpine3.21/Dockerfile +++ b/3.4/alpine3.21/Dockerfile @@ -6,17 +6,6 @@ FROM alpine:3.21 -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - # skip installing gem documentation with `gem install`/`gem update` RUN set -eux; \ mkdir -p /usr/local/etc; \ @@ -44,6 +33,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -55,6 +45,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ ruby \ tar \ xz \ diff --git a/3.4/slim-bookworm/Dockerfile b/3.4/slim-bookworm/Dockerfile index b41f3d301..5043d2115 100644 --- a/3.4/slim-bookworm/Dockerfile +++ b/3.4/slim-bookworm/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bookworm-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -43,17 +36,23 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/3.4/slim-bullseye/Dockerfile b/3.4/slim-bullseye/Dockerfile index a00693b9d..8a0494a27 100644 --- a/3.4/slim-bullseye/Dockerfile +++ b/3.4/slim-bullseye/Dockerfile @@ -9,14 +9,7 @@ FROM debian:bullseye-slim RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -43,17 +36,23 @@ RUN set -eux; \ libgdbm-dev \ ruby \ autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/*; \ \ diff --git a/Dockerfile.template b/Dockerfile.template index 3c17e9857..821dd3f38 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -13,30 +13,11 @@ FROM debian:{{ env.variant | ltrimstr("slim-") }}-slim FROM buildpack-deps:{{ env.variant }} {{ ) end -}} -{{ if is_alpine then ( -}} -RUN set -eux; \ - apk add --no-cache \ - bzip2 \ - ca-certificates \ - gmp-dev \ - libffi-dev \ - procps \ - yaml-dev \ - zlib-dev \ - ; - -{{ ) elif is_slim then ( -}} +{{ if is_slim then ( -}} RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - bzip2 \ ca-certificates \ - libffi-dev \ - libgmp-dev \ - libssl-dev \ - libyaml-dev \ - procps \ - zlib1g-dev \ ; \ rm -rf /var/lib/apt/lists/* @@ -73,6 +54,7 @@ RUN set -eux; \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ @@ -84,6 +66,8 @@ RUN set -eux; \ openssl-dev \ patch \ procps \ + yaml-dev \ + zlib-dev \ {{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}} readline-dev \ {{ ) else "" end -}} @@ -106,20 +90,26 @@ RUN set -eux; \ ruby \ {{ if is_slim then ( -}} autoconf \ + bzip2 \ g++ \ gcc \ libbz2-dev \ + libffi-dev \ libgdbm-compat-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ {{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}} libreadline-dev \ {{ ) else "" end -}} + libssl-dev \ libxml2-dev \ libxslt-dev \ + libyaml-dev \ make \ wget \ xz-utils \ + zlib1g-dev \ {{ ) else "" end -}} ; \ rm -rf /var/lib/apt/lists/*; \