Skip to content

Commit 3ca94ae

Browse files
authored
feat(build)!: Change to use debian base images (#83)
* feat(build)!: Change to use ubuntu base images * feat(build)!: Change to use Debian base images
1 parent b1e8a6c commit 3ca94ae

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

.github/workflows/container.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,16 @@ jobs:
2121
# Go hard on the builders
2222
max-parallel: 5
2323
matrix:
24-
alpine-version: ['3.20', '3.19']
24+
debian-version: ['bookworm', 'bullseye']
2525
ruby-version: ['3.3.6', '3.3.5', '3.3.4']
26-
# Only 3.3.6 is published (to docker.io) for 3.21, so we include only that here.
27-
include:
28-
- alpine-version: '3.21'
29-
ruby-version: '3.3.6'
3026
steps:
3127
-
3228
name: Checkout repository
3329
uses: actions/checkout@v4
3430
-
3531
name: Publish to ghcr.io
3632
env:
37-
ALPINE_VERSION: ${{ matrix.alpine-version }}
33+
DEBIAN_VERSION: ${{ matrix.debian-version }}
3834
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3935
RUBY_VERSION: ${{ matrix.ruby-version }}
4036
TAG: ${{ github.event.inputs.tag || '' }}
@@ -58,7 +54,7 @@ jobs:
5854
[ "$TRACE" = 'true' ] && printf 'Calling ./ci/build_image.sh -vvp "%s"\n' "$version" >&2
5955
IMAGE_NAME=$(basename "$GITHUB_REPOSITORY") \
6056
GITHUB_TOKEN=$REGISTRY_TOKEN \
61-
ALPINE_VERSION=$ALPINE_VERSION \
57+
DEBIAN_VERSION=$DEBIAN_VERSION \
6258
RUBY_VERSION=$RUBY_VERSION \
6359
./ci/build_image.sh -vvp "$version"
6460
# yamllint enable rule:line-length

ci/build_image.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ cd "$repo_top" || {
2525
}
2626

2727
base_dir=$(basename "$(pwd)")
28-
: "${ALPINE_VERSION:=3.20}"
28+
: "${DEBIAN_VERSION:=bookworm}"
2929
: "${BUILD_CONTEXT:=$(pwd)}"
3030
: "${IMAGE_NAME:=$base_dir}"
3131
: "${LICENSE:=MIT}"
3232
: "${REGISTRY:=ghcr.io}"
33-
: "${RUBY_VERSION:=3.3.4}"
33+
: "${RUBY_VERSION:=3.3.6}"
3434
: "${REGISTRY_TOKEN:=$GITHUB_TOKEN}"
3535

36-
base_image_tag="$RUBY_VERSION-alpine$ALPINE_VERSION"
36+
base_image_tag="$RUBY_VERSION-$DEBIAN_VERSION"
3737
base_exists=$(skopeo list-tags docker://docker.io/ruby |jq -r "any(.Tags[] == \"$base_image_tag\"; .)")
3838
if [ "$base_exists" = "false" ]
3939
then
@@ -209,7 +209,7 @@ fi
209209
service=$(basename "$owner_and_repo" .git)
210210
owner=$(dirname "$owner_and_repo")
211211

212-
full_tag=$IMAGE_NAME:$tag-ruby$RUBY_VERSION-alpine$ALPINE_VERSION
212+
full_tag=$IMAGE_NAME:$tag-ruby$RUBY_VERSION-$DEBIAN_VERSION
213213
# Pass any extra arguments to the build command ("$@" contains the rest of the arguments)
214214
$runtime build --tag "$full_tag" "$@" \
215215
--label org.opencontainers.image.created="$(date --utc --iso-8601=seconds)" \
@@ -221,7 +221,7 @@ $runtime build --tag "$full_tag" "$@" \
221221
--label org.opencontainers.image.source="Generated by ruby-automation's build_image.sh ($USER@$HOSTNAME)" \
222222
--label org.opencontainers.image.version="$full_tag" \
223223
--label shortref="$shortref" \
224-
--build-arg ALPINE_VERSION="$ALPINE_VERSION" \
224+
--build-arg DEBIAN_VERSION="$DEBIAN_VERSION" \
225225
--build-arg RUBY_VERSION="$RUBY_VERSION" \
226226
-f "$containerfile" "$BUILD_CONTEXT" || die 8 "Failed to build image"
227227

@@ -237,7 +237,7 @@ fi
237237
mapfile -t tags < <(echo "$tag" | awk -F'.' 'NF==3{print; print $1"."$2; print $1; next} NF==2{print; print $1; next} {print}')
238238
for t in "${tags[@]}"
239239
do
240-
new_tag=$IMAGE_NAME:$t-ruby$RUBY_VERSION-alpine$ALPINE_VERSION
240+
new_tag=$IMAGE_NAME:$t-ruby$RUBY_VERSION-$DEBIAN_VERSION
241241
registry_image_name="$REGISTRY/$owner/$new_tag"
242242
if [ "$runtime" = "podman" ]
243243
then

oci/Containerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG ALPINE_VERSION=3.20
2-
ARG RUBY_VERSION=3.3.4
3-
FROM docker.io/ruby:$RUBY_VERSION-alpine$ALPINE_VERSION AS build-env
1+
ARG DEBIAN_VERSION=bookworm
2+
ARG RUBY_VERSION=3.3.6
3+
FROM docker.io/ruby:$RUBY_VERSION-$DEBIAN_VERSION AS build-env
44

55
# Setting env up
66
ARG APP_ROOT=/app
@@ -9,7 +9,7 @@ ENV LANG C.UTF-8
99
ENV BUNDLE_SILENCE_ROOT_WARNING=1
1010

1111
#Install dependencies needed for compilation
12-
RUN apk --no-cache add curl ruby-dev build-base git
12+
RUN apt-get update && apt-get install -qy build-essential curl git
1313

1414
WORKDIR $APP_ROOT
1515

@@ -33,17 +33,17 @@ RUN bundle config set build.nokogiri --use-system-libraries && \
3333
RUN rm -rf node_modules tmp/cache app/assets vendor/assets spec
3434

3535
############### Build step done ###############
36-
ARG ALPINE_VERSION=3.20
37-
ARG RUBY_VERSION=3.3.4
38-
FROM docker.io/ruby:$RUBY_VERSION-alpine$ALPINE_VERSION
36+
ARG DEBIAN_VERSION=bookworm
37+
ARG RUBY_VERSION=3.3.6
38+
FROM docker.io/ruby:$RUBY_VERSION-$DEBIAN_VERSION
3939

4040
ARG APP_ROOT=/app
4141

4242
WORKDIR $APP_ROOT
4343

4444
# install packages
45-
RUN apk --update --no-cache add coreutils curl bash runit
45+
RUN apt-get update && apt-get install -qy curl bash runit
4646
COPY --from=build-env /usr/local/bundle/ /usr/local/bundle/
4747
COPY --from=build-env /bin/snooze /bin/snooze
4848

49-
CMD ['/bin/sh']
49+
CMD ['/bin/bash']

0 commit comments

Comments
 (0)