Skip to content

Commit c072ef9

Browse files
committed
Add Ruby versions 3.3.6 and 3.2.6
* simplify Dockerfile using heredoc strings
1 parent 75f2f32 commit c072ef9

File tree

2 files changed

+148
-130
lines changed

2 files changed

+148
-130
lines changed

.github/workflows/docker-build.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
ruby:
15+
- 3.3.6
1516
- 3.3.5
16-
- 3.3.4
17-
- 3.2.5
18-
- 3.2.2
17+
- 3.2.6
1918
variant: ["", "-alpine"]
2019
exclude: []
2120
include: []
@@ -51,17 +50,17 @@ jobs:
5150
hnhs/ruby-dev:${{ matrix.ruby }}${{ matrix.variant }}
5251
ghcr.io/hicknhack-software/ruby-dev:${{ matrix.ruby }}${{ matrix.variant }}
5352
54-
${{ matrix.ruby == '3.3.5' && format('hnhs/ruby-dev:latest{0}', matrix.variant) || '' }}
55-
${{ matrix.ruby == '3.3.5' && format('ghcr.io/hicknhack-software/ruby-dev:latest{0}', matrix.variant) || '' }}
53+
${{ matrix.ruby == '3.3.6' && format('hnhs/ruby-dev:latest{0}', matrix.variant) || '' }}
54+
${{ matrix.ruby == '3.3.6' && format('ghcr.io/hicknhack-software/ruby-dev:latest{0}', matrix.variant) || '' }}
5655
57-
${{ matrix.ruby == '3.3.5' && format('hnhs/ruby-dev:3{0}', matrix.variant) || '' }}
58-
${{ matrix.ruby == '3.3.5' && format('ghcr.io/hicknhack-software/ruby-dev:3{0}', matrix.variant) || '' }}
56+
${{ matrix.ruby == '3.3.6' && format('hnhs/ruby-dev:3{0}', matrix.variant) || '' }}
57+
${{ matrix.ruby == '3.3.6' && format('ghcr.io/hicknhack-software/ruby-dev:3{0}', matrix.variant) || '' }}
5958
60-
${{ matrix.ruby == '3.3.5' && format('hnhs/ruby-dev:3.3{0}', matrix.variant) || '' }}
61-
${{ matrix.ruby == '3.3.5' && format('ghcr.io/hicknhack-software/ruby-dev:3.3{0}', matrix.variant) || '' }}
59+
${{ matrix.ruby == '3.3.6' && format('hnhs/ruby-dev:3.3{0}', matrix.variant) || '' }}
60+
${{ matrix.ruby == '3.3.6' && format('ghcr.io/hicknhack-software/ruby-dev:3.3{0}', matrix.variant) || '' }}
6261
63-
${{ matrix.ruby == '3.2.5' && format('ghcr.io/hicknhack-software/ruby-dev:3.2{0}', matrix.variant) || '' }}
64-
${{ matrix.ruby == '3.2.5' && format('hnhs/ruby-dev:3.2{0}', matrix.variant) || '' }}
62+
${{ matrix.ruby == '3.2.6' && format('ghcr.io/hicknhack-software/ruby-dev:3.2{0}', matrix.variant) || '' }}
63+
${{ matrix.ruby == '3.2.6' && format('hnhs/ruby-dev:3.2{0}', matrix.variant) || '' }}
6564
6665
cache-from: type=gha
6766
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 138 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -29,132 +29,151 @@ ENV PORT="5000" \
2929
DISABLE_SPRING="true"
3030

3131
# Install dependencies
32-
RUN set -eux; \
33-
osType="$(sed -n 's|^ID=||p' /etc/os-release)"; \
34-
\
35-
case "${osType}" in \
36-
alpine) \
37-
alpineMajorVersion=$(sed -nr 's/^VERSION_ID=(\d+\.\d+).*/\1/p' /etc/os-release); \
38-
\
39-
# Use `libpq-dev` (~20MB) rather than `postgresql-dev` (~200MB) if available
40-
# (the former was extracted from the latter in Alpine 3.15)
41-
case ${alpineMajorVersion} in \
42-
3.3|3.4|3.5|3.6|3.7|3.8|3.9|3.10|3.11|3.12|3.13|3.14) libpqPackage="postgresql-dev" ;; \
43-
3.15|*) libpqPackage="libpq-dev" ;; \
44-
esac; \
45-
\
46-
apk add --no-cache \
47-
alpine-sdk \
48-
openssh \
49-
curl \
50-
jq \
51-
nano \
52-
nodejs \
53-
postgresql \
54-
vim \
55-
yarn \
56-
${libpqPackage} \
57-
; \
58-
;; \
32+
RUN <<INSTALL_DEPENDENCIES
33+
set -eux
34+
osType="$(sed -n 's|^ID=||p' /etc/os-release)"
35+
36+
case "${osType}" in
37+
alpine) \
38+
alpineMajorVersion=$(sed -nr 's/^VERSION_ID=(\d+\.\d+).*/\1/p' /etc/os-release)
39+
\
40+
# Use `libpq-dev` (~20MB) rather than `postgresql-dev` (~200MB) if available
41+
# (the former was extracted from the latter in Alpine 3.15)
42+
case ${alpineMajorVersion} in
43+
3.3|3.4|3.5|3.6|3.7|3.8|3.9|3.10|3.11|3.12|3.13|3.14)
44+
libpqPackage="postgresql-dev"
45+
;;
46+
3.15|*)
47+
libpqPackage="libpq-dev"
48+
;;
49+
esac
50+
51+
apk add --no-cache \
52+
alpine-sdk \
53+
openssh \
54+
curl \
55+
jq \
56+
nano \
57+
nodejs \
58+
postgresql \
59+
vim \
60+
yarn \
61+
${libpqPackage}
62+
63+
;;
64+
65+
debian|ubuntu) \
66+
# Fix Jessie & Stretch APT sources (they have been moved to http://archive.debian.org)
67+
if [ -f /etc/apt/sources.list ]; then
68+
sed -i -r \
69+
-e '/(jessie|stretch)[-\/]updates/d' \
70+
-e 's|http://(deb\|httpredir).debian.org/debian (jessie\|stretch)|http://archive.debian.org/debian \2|' \
71+
/etc/apt/sources.list
72+
fi
73+
\
74+
# Detect Debian version
75+
apt-get update
76+
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
77+
apt-transport-https \
78+
lsb-release
79+
80+
debianReleaseCodename=$(lsb_release -cs)
81+
\
82+
# Fix LetsEncrypt expired CA on older Debian releases
83+
case ${debianReleaseCodename} in
84+
jessie|buster|stretch)
85+
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
86+
ca-certificates \
87+
curl \
88+
$([ "${debianReleaseCodename}" = "jessie" ] && echo "libssl1.0.0")
89+
90+
sed -i 's|mozilla/DST_Root_CA_X3.crt|!mozilla/DST_Root_CA_X3.crt|g' /etc/ca-certificates.conf
91+
update-ca-certificates
92+
;;
93+
esac
94+
\
95+
# Add PostgreSQL APT repository
96+
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
97+
case ${debianReleaseCodename} in
98+
jessie|stretch)
99+
echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${debianReleaseCodename}-pgdg-archive main"
100+
;;
101+
*)
102+
echo "deb https://apt.postgresql.org/pub/repos/apt/ ${debianReleaseCodename}-pgdg main"
103+
;;
104+
esac > /etc/apt/sources.list.d/pgdg.list
105+
\
106+
# Add NodeJS APT repository
107+
case ${debianReleaseCodename} in
108+
jessie)
109+
curl -fsSL https://deb.nodesource.com/setup_14.x
110+
;;
111+
stretch)
112+
curl -fsSL https://deb.nodesource.com/setup_16.x
113+
;;
114+
*)
115+
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x
116+
;;
117+
esac | bash
118+
\
119+
# Install everything
120+
apt-get update
121+
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
122+
jq \
123+
nano \
124+
nodejs \
125+
postgresql-client \
126+
vim
127+
128+
\
129+
# Cleanup
130+
rm -rf /var/lib/apt/lists/*
131+
\
132+
# Install Yarn (via NPM)
133+
npm install --global yarn
59134
\
60-
debian|ubuntu) \
61-
# Fix Jessie & Stretch APT sources (they have been moved to http://archive.debian.org)
62-
if [ -f /etc/apt/sources.list ]; then \
63-
sed -i -r \
64-
-e '/(jessie|stretch)[-\/]updates/d' \
65-
-e 's|http://(deb\|httpredir).debian.org/debian (jessie\|stretch)|http://archive.debian.org/debian \2|' \
66-
/etc/apt/sources.list; \
67-
fi; \
68-
\
69-
# Detect Debian version
70-
apt-get update; \
71-
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
72-
apt-transport-https \
73-
lsb-release \
74-
; \
75-
debianReleaseCodename=$(lsb_release -cs); \
76-
\
77-
# Fix LetsEncrypt expired CA on older Debian releases
78-
case ${debianReleaseCodename} in \
79-
jessie|buster|stretch) \
80-
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
81-
ca-certificates \
82-
curl \
83-
$([ "${debianReleaseCodename}" = "jessie" ] && echo "libssl1.0.0") \
84-
; \
85-
sed -i 's|mozilla/DST_Root_CA_X3.crt|!mozilla/DST_Root_CA_X3.crt|g' /etc/ca-certificates.conf; \
86-
update-ca-certificates; \
87-
;; \
88-
esac; \
89-
\
90-
# Add PostgreSQL APT repository
91-
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg; \
92-
case ${debianReleaseCodename} in \
93-
jessie|stretch) echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${debianReleaseCodename}-pgdg-archive main" ;; \
94-
*) echo "deb https://apt.postgresql.org/pub/repos/apt/ ${debianReleaseCodename}-pgdg main" ;; \
95-
esac > /etc/apt/sources.list.d/pgdg.list; \
96-
\
97-
# Add NodeJS APT repository
98-
case ${debianReleaseCodename} in \
99-
jessie) curl -fsSL https://deb.nodesource.com/setup_14.x ;; \
100-
stretch) curl -fsSL https://deb.nodesource.com/setup_16.x ;; \
101-
*) curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x ;; \
102-
esac | bash; \
103-
\
104-
# Install everything
105-
apt-get update; \
106-
apt-get install --assume-yes --no-install-recommends --no-install-suggests --force-yes \
107-
jq \
108-
nano \
109-
nodejs \
110-
postgresql-client \
111-
vim \
112-
; \
113-
\
114-
# Cleanup
115-
rm -rf /var/lib/apt/lists/*; \
116-
\
117-
# Install Yarn (via NPM)
118-
npm install --global yarn; \
119-
\
120-
# Install Heroku CLI (standalone tarball)
121-
curl -sSL curl https://cli-assets.heroku.com/install.sh | sh; \
122-
;; \
123-
esac;
135+
# Install Heroku CLI (standalone tarball)
136+
curl -sSL curl https://cli-assets.heroku.com/install.sh | sh
137+
esac
138+
INSTALL_DEPENDENCIES
124139

125140
# Install `gosu`
126141
ARG TARGETARCH # provided by Docker multi-platform support: https://docs.docker.com/build/guide/multi-platform
127-
RUN set -eux; \
128-
osType="$(sed -n 's|^ID=||p' /etc/os-release)"; \
129-
export GNUPGHOME="$(mktemp -d)"; \
130-
\
131-
# Install GPG on Alpine (for signature verification)
132-
[ "${osType}" = "alpine" ] && apk add --no-cache --virtual .gosu-deps gnupg || :; \
133-
\
134-
# Fetch author public key
135-
for keyserver in $(shuf -e keyserver.ubuntu.com keys.openpgp.org keys.mailvelope.com); do \
136-
gpg --batch --no-tty --keyserver "${keyserver}" --recv-keys "B42F6819007F00F88E364FD4036A9C25BF357DD4" && break || :; \
137-
done; \
138-
\
139-
# Download binary
140-
curl -sSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH}"; \
141-
chmod +x /usr/local/bin/gosu; \
142-
\
143-
# Verify binary signature
144-
curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH}.asc" \
145-
| gpg --batch --verify - /usr/local/bin/gosu; \
146-
\
147-
# Cleanup
148-
command -v gpgconf && gpgconf --kill all || :; \
149-
rm -rf "${GNUPGHOME}"; \
150-
unset -v GNUPGHOME; \
151-
[ "${osType}" = "alpine" ] && apk del --no-network .gosu-deps || :;
142+
RUN <<INSTALL_GOSU
143+
set -eux
144+
osType="$(sed -n 's|^ID=||p' /etc/os-release)"
145+
export GNUPGHOME="$(mktemp -d)"
146+
\
147+
# Install GPG on Alpine (for signature verification)
148+
[ "${osType}" = "alpine" ] && apk add --no-cache --virtual .gosu-deps gnupg || :
149+
\
150+
# Fetch author public key
151+
for keyserver in $(shuf -e keyserver.ubuntu.com keys.openpgp.org keys.mailvelope.com); do
152+
gpg --batch --no-tty --keyserver "${keyserver}" --recv-keys "B42F6819007F00F88E364FD4036A9C25BF357DD4" && break || :
153+
done
154+
\
155+
# Download binary
156+
curl -sSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH}"
157+
chmod +x /usr/local/bin/gosu
158+
\
159+
# Verify binary signature
160+
curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH}.asc" \
161+
| gpg --batch --verify - /usr/local/bin/gosu
162+
\
163+
# Cleanup
164+
command -v gpgconf && gpgconf --kill all || :
165+
rm -rf "${GNUPGHOME}"
166+
unset -v GNUPGHOME
167+
[ "${osType}" = "alpine" ] && apk del --no-network .gosu-deps || :
168+
INSTALL_GOSU
152169

153170
# Install GEM dependencies
154171
# Note: we still need Bundler 1.x because Bundler auto-switches to it when it encounters a Gemfile.lock with BUNDLED WITH 1.x
155-
RUN gem update --system ${RUBYGEMS_VERSION_ARG} \
156-
&& gem install bundler${BUNDLER_VERSION_ARG:+:${BUNDLER_VERSION_ARG}} \
157-
&& gem install bundler:1.17.3
172+
RUN <<INSTALL_BUNDLERS
173+
gem update --system ${RUBYGEMS_VERSION_ARG}
174+
gem install bundler${BUNDLER_VERSION_ARG:+:${BUNDLER_VERSION_ARG}}
175+
gem install bundler:1.17.3
176+
INSTALL_BUNDLERS
158177

159178
# Add dot files to the home directory skeleton (they persist IRB/Pry/Rails console history, configure Yarn, etc…)
160179
COPY dotfiles/* /etc/skel/

0 commit comments

Comments
 (0)