Skip to content

Commit 619b748

Browse files
committed
Split away gnu and centos compilers
1 parent b1b1a7a commit 619b748

File tree

104 files changed

+1253
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1253
-575
lines changed

.github/workflows/build-ruby-compilers.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,75 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
include:
38+
# gnu
39+
- engine: ruby
40+
version: "1.8"
41+
libc: gnu
42+
arch: ["x86_64"]
43+
- engine: ruby
44+
version: "1.9"
45+
libc: gnu
46+
arch: ["x86_64"]
47+
- engine: ruby
48+
version: "2.0"
49+
libc: gnu
50+
arch: ["x86_64"]
51+
- engine: ruby
52+
version: "2.1"
53+
libc: gnu
54+
arch: ["x86_64", "aarch64"]
55+
- engine: ruby
56+
version: "2.2"
57+
libc: gnu
58+
arch: ["x86_64", "aarch64"]
59+
- engine: ruby
60+
version: "2.3"
61+
libc: gnu
62+
arch: ["x86_64", "aarch64"]
63+
- engine: ruby
64+
version: "2.4"
65+
libc: gnu
66+
arch: ["x86_64", "aarch64"]
67+
- engine: ruby
68+
version: "2.5"
69+
libc: gnu
70+
arch: ["x86_64", "aarch64"]
71+
- engine: ruby
72+
version: "2.6"
73+
libc: gnu
74+
arch: ["x86_64", "aarch64"]
75+
- engine: ruby
76+
version: "2.7"
77+
libc: gnu
78+
arch: ["x86_64", "aarch64"]
79+
- engine: ruby
80+
version: "3.0"
81+
libc: gnu
82+
arch: ["x86_64", "aarch64"]
83+
- engine: ruby
84+
version: "3.1"
85+
libc: gnu
86+
arch: ["x86_64", "aarch64"]
87+
- engine: ruby
88+
version: "3.2"
89+
libc: gnu
90+
arch: ["x86_64", "aarch64"]
91+
- engine: ruby
92+
version: "3.3"
93+
libc: gnu
94+
arch: ["x86_64", "aarch64"]
95+
- engine: ruby
96+
version: "3.4"
97+
libc: gnu
98+
arch: ["x86_64", "aarch64"]
99+
- engine: ruby
100+
version: "3.5"
101+
libc: gnu
102+
arch: ["x86_64", "aarch64"]
103+
- engine: ruby
104+
version: "4.0"
105+
libc: gnu
106+
arch: ["x86_64", "aarch64"]
38107
# musl
39108
- engine: ruby
40109
version: "2.1"
@@ -108,6 +177,75 @@ jobs:
108177
version: "10.0"
109178
libc: musl
110179
arch: ["x86_64", "aarch64"]
180+
# centos
181+
- engine: ruby
182+
version: "1.8"
183+
libc: centos
184+
arch: ["x86_64"]
185+
- engine: ruby
186+
version: "1.9"
187+
libc: centos
188+
arch: ["x86_64"]
189+
- engine: ruby
190+
version: "2.0"
191+
libc: centos
192+
arch: ["x86_64"]
193+
- engine: ruby
194+
version: "2.1"
195+
libc: centos
196+
arch: ["x86_64", "aarch64"]
197+
- engine: ruby
198+
version: "2.2"
199+
libc: centos
200+
arch: ["x86_64", "aarch64"]
201+
- engine: ruby
202+
version: "2.3"
203+
libc: centos
204+
arch: ["x86_64", "aarch64"]
205+
- engine: ruby
206+
version: "2.4"
207+
libc: centos
208+
arch: ["x86_64", "aarch64"]
209+
- engine: ruby
210+
version: "2.5"
211+
libc: centos
212+
arch: ["x86_64", "aarch64"]
213+
- engine: ruby
214+
version: "2.6"
215+
libc: centos
216+
arch: ["x86_64", "aarch64"]
217+
- engine: ruby
218+
version: "2.7"
219+
libc: centos
220+
arch: ["x86_64", "aarch64"]
221+
- engine: ruby
222+
version: "3.0"
223+
libc: centos
224+
arch: ["x86_64", "aarch64"]
225+
- engine: ruby
226+
version: "3.1"
227+
libc: centos
228+
arch: ["x86_64", "aarch64"]
229+
- engine: ruby
230+
version: "3.2"
231+
libc: centos
232+
arch: ["x86_64", "aarch64"]
233+
- engine: ruby
234+
version: "3.3"
235+
libc: centos
236+
arch: ["x86_64", "aarch64"]
237+
- engine: ruby
238+
version: "3.4"
239+
libc: centos
240+
arch: ["x86_64", "aarch64"]
241+
- engine: ruby
242+
version: "3.5"
243+
libc: centos
244+
arch: ["x86_64", "aarch64"]
245+
- engine: ruby
246+
version: "4.0"
247+
libc: centos
248+
arch: ["x86_64", "aarch64"]
111249
name: ${{ matrix.engine }}:${{ matrix.version }}-${{ matrix.libc }}${{ inputs.tag_suffix }}
112250
uses: ./.github/workflows/_build-image.yml
113251
with:

.github/workflows/ruby.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
push: ${{ inputs.push || false }}
2424
secrets: inherit
2525

26-
# Stage 2: Build musl compiler images (musl.gcc, musl.clang)
26+
# Stage 2: Build compiler images (gnu.gcc, gnu.clang, musl.gcc, musl.clang, centos.gcc, centos.clang)
2727
#
28-
# These depend on the base musl images existing in the registry.
29-
# The compiler Dockerfiles FROM the release tag (e.g. FROM ...ruby:3.3-musl)
28+
# These depend on the base images existing in the registry.
29+
# The compiler Dockerfiles FROM the release tag (e.g. FROM ...ruby:3.3-gnu)
3030
# but _build-image.yml uses --build-context to override it with the
3131
# commit-tagged base image from this pipeline run, so correctness does not
3232
# depend on the release tag being pushed.

src/engines/ruby/1.8/Dockerfile.centos

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,8 @@ RUN true "${REPRO_RUN_KEY}" && yum makecache -y
7070
# fun: CentOS 8 has `yum list glibc-langpack-\*` but not CentOS 7 :'(
7171
RUN yum reinstall -y glibc-common
7272

73-
RUN yum install -y curl gcc gcc-c++ gettext make patchutils patch libtool pkgconfig gettext file zip unzip git
74-
75-
# fun: this has to be after `yum install curl gcc make`... but only on aarch64; go figure
76-
# extra fun: table is botched, localedef not happy, swallow result and test `locale` for errors
77-
RUN <<SHELL
78-
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || true
79-
if locale 2>&1 | grep -e 'locale: Cannot set LC_.* to default locale: No such file or directory'; then exit 1; fi
80-
SHELL
81-
73+
# Install runtime packages only (no compiler or build tools)
74+
RUN yum install -y curl gettext file zip unzip git
8275
# Skip installing gem documentation
8376
COPY <<GEMRC /usr/local/etc/gemrc
8477
install: --no-document
@@ -96,7 +89,24 @@ ENV LANG="en_US.UTF-8"
9689
RUN <<SHELL
9790
set -eux
9891

99-
yum install -y xz gcc automake bison zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel
92+
# --- Install compiler and build dependencies ---
93+
# Install runtime libraries that Ruby links against; these must be present
94+
# BEFORE the checkpoint so they survive the rollback.
95+
yum install -y zlib libyaml gdbm readline ncurses-libs libffi openssl-libs
96+
97+
# Record checkpoint: everything after this transaction will be rolled back.
98+
yum_checkpoint=$(yum history list all 2>/dev/null | awk '$1 ~ /^[0-9]+$/ {print $1; exit}')
99+
100+
yum install -y \
101+
gcc gcc-c++ make patchutils patch libtool pkgconfig xz automake autoconf bison \
102+
zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel
103+
104+
# fun: locale setup has to be after installing gcc/make... but only on aarch64; go figure
105+
# extra fun: table is botched, localedef not happy, swallow result and test 'locale' for errors
106+
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || true
107+
if locale 2>&1 | grep -e 'locale: Cannot set LC_.* to default locale: No such file or directory'; then exit 1; fi
108+
109+
# --- Build Ruby ---
100110

101111
curl -L -o ruby.tar.gz "https://github.com/ruby/ruby/archive/f48ae0d10c5b586db5748b0d4b645c7e9ff5d52e.tar.gz"
102112
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum --check --strict
@@ -158,32 +168,6 @@ gnuArch="$(uname -m)-linux-gnu"
158168
make
159169
make install
160170

161-
# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
162-
# | awk '/=>/ { print $(NF-1) }' \
163-
# | sort -u \
164-
# | grep -vE '^/usr/local/lib/' \
165-
# | xargs -r dpkg-query --search \
166-
# | cut -d: -f1 \
167-
# | sort -u \
168-
# | xargs -r apt-mark manual \
169-
#
170-
# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
171-
#
172-
# find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
173-
# | awk '/=>/ { print $(NF-1) }' \
174-
# | grep -v '=>' \
175-
# | sort -u \
176-
# | grep -vE '^/usr/local/lib/' \
177-
# | xargs -r rpm -qf \
178-
# | sort -u \
179-
# | xargs -r yum ?mark-manual?
180-
#
181-
# yum autoremove -y
182-
# yum remove --setopt=clean_requirements_on_remove=1
183-
# package-cleanup --leaves && yum autoremove # yum-utils
184-
# sudo yum history list pdftk
185-
# sudo yum history undo 88
186-
187171
cd /
188172
rm -r /usr/src/ruby
189173
if yum list installed ruby; then exit 1; fi
@@ -239,6 +223,14 @@ ruby --version
239223
gem --version
240224
bundle --version
241225

226+
# --- Clean up compiler and build dependencies ---
227+
# Roll back to the checkpoint: removes compilers, build tools, and -devel
228+
# packages while preserving the runtime libraries installed before
229+
# the checkpoint.
230+
yum -y history rollback "${yum_checkpoint}"
231+
yum clean all
232+
233+
242234
SHELL
243235

244236
# don't create ".bundle" in all our apps
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/datadog/images-rb/engines/ruby:1.8-centos
2+
3+
RUN yum install -y epel-release && yum install -y clang make binutils file patch
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/datadog/images-rb/engines/ruby:1.8-centos
2+
3+
RUN yum install -y gcc gcc-c++ make binutils file patch

src/engines/ruby/1.8/Dockerfile.gnu

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# platforms: linux/x86_64
2-
# strip-tags: gnu
3-
# append-tags: gcc
42

53
# Debian 11 (bullseye)
64
FROM public.ecr.aws/docker/library/debian:11
@@ -63,6 +61,7 @@ ENV LANG="en_US.UTF-8"
6361
RUN <<SHELL
6462
set -eux
6563

64+
# --- Install compiler and build dependencies ---
6665
apt-get install -y \
6766
curl \
6867
ca-certificates \
@@ -84,6 +83,8 @@ apt-get install -y \
8483
libffi-dev \
8584
--no-install-recommends
8685

86+
# --- Build Ruby ---
87+
8788
# Ruby 1.8 needs OpenSSL 1.0.x; Debian 11's OpenSSL 1.1.x is incompatible
8889
OPENSSL_VERSION='1.0.2u'
8990
OPENSSL_SHA256='ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16'
@@ -234,9 +235,17 @@ ruby --version
234235
gem --version
235236
bundle --version
236237

237-
# clean up apt lists
238+
# --- Clean up compiler and build dependencies ---
239+
# Note: --auto-remove is deliberately NOT used because runtime libraries
240+
# (libyaml, libffi, libssl, etc.) were auto-installed as dependencies of
241+
# -dev packages and apt has no way to know that Ruby needs them at runtime.
242+
apt-get purge -y \
243+
gcc g++ cpp make autoconf bison patch build-essential xz-utils \
244+
libc6-dev zlib1g-dev libyaml-dev libgdbm-dev libreadline-dev \
245+
libncurses5-dev libncurses-dev libffi-dev libssl-dev
238246
rm -rf /var/lib/apt/lists/*
239247

248+
240249
SHELL
241250

242251
# don't create ".bundle" in all our apps
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ghcr.io/datadog/images-rb/engines/ruby:1.8-gnu
2+
3+
RUN apt-get install -y \
4+
binutils \
5+
file \
6+
make \
7+
libc6-dev \
8+
clang \
9+
--no-install-recommends
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ghcr.io/datadog/images-rb/engines/ruby:1.8-gnu
2+
3+
RUN apt-get install -y \
4+
binutils \
5+
file \
6+
make \
7+
libc6-dev \
8+
gcc \
9+
g++ \
10+
--no-install-recommends

0 commit comments

Comments
 (0)