From cdbe4e11eb2024c6cd6184611f2f422e41fee998 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Tue, 21 Jan 2025 06:17:48 +1100 Subject: [PATCH] build: add Ruby 3.4 images --- Makefile | 3 +- helpers/TESTING_base_images_dockercompose.md | 7 +++ helpers/images-docker-compose.yml | 10 ++++ images/ruby/3.4.Dockerfile | 53 ++++++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 images/ruby/3.4.Dockerfile diff --git a/Makefile b/Makefile index a66aaf469..f9ecb0af6 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,7 @@ versioned-images := php-8.1-fpm \ ruby-3.1 \ ruby-3.2 \ ruby-3.3 \ + ruby-3.4 \ opensearch-2 \ mysql-8.0 \ mysql-8.4 \ @@ -321,7 +322,7 @@ build/mariadb-10.4-drupal: build/mariadb-10.4 build/mariadb-10.5-drupal: build/mariadb-10.5 build/mariadb-10.6-drupal: build/mariadb-10.6 build/mariadb-10.11-drupal: build/mariadb-10.11 -build/ruby-3.1 build/ruby-3.2 build/ruby-3.3: build/commons +build/ruby-3.1 build/ruby-3.2 build/ruby-3.3 build/ruby-3.4: build/commons build/opensearch-2: build/commons build/mongo-4: build/commons build/mysql-8.0 build/mysql-8.4: build/commons diff --git a/helpers/TESTING_base_images_dockercompose.md b/helpers/TESTING_base_images_dockercompose.md index 42706f92a..8cc74a2dc 100644 --- a/helpers/TESTING_base_images_dockercompose.md +++ b/helpers/TESTING_base_images_dockercompose.md @@ -55,6 +55,7 @@ docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-1 docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-2 docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-3 +docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-4 # commons should be running Alpine Linux docker compose exec -T commons sh -c "cat /etc/os-release" | grep "Alpine Linux" @@ -315,6 +316,12 @@ docker compose exec -T ruby-3-3 sh -c "ruby -v" | grep "3.3" # ruby-3-3 should be serving content docker compose exec -T commons sh -c "curl ruby-3-3:3000/tmp/" | grep "ruby 3.3" + +# ruby-3-4 should have Ruby 3.4 +docker compose exec -T ruby-3-4 sh -c "ruby -v" | grep "3.4" + +# ruby-3-4 should be serving content +docker compose exec -T commons sh -c "curl ruby-3-4:3000/tmp/" | grep "ruby 3.4" ``` Destroy tests diff --git a/helpers/images-docker-compose.yml b/helpers/images-docker-compose.yml index 308b4dc15..bf9e4a1d4 100644 --- a/helpers/images-docker-compose.yml +++ b/helpers/images-docker-compose.yml @@ -253,6 +253,16 @@ services: exec ruby -run -e httpd / -p 3000 "] + ruby-3-4: + image: uselagoon/ruby-3.4:latest + ports: + - "3000" + << : *default-user # uses the defined user from top + command: ["sh", "-c", " + ruby -v | xargs > /tmp/index.html; + exec ruby -run -e httpd / -p 3000 + "] + internal-services-test: image: docker.io/uselagoon/internal-services-test:main ports: diff --git a/images/ruby/3.4.Dockerfile b/images/ruby/3.4.Dockerfile new file mode 100644 index 000000000..21dfd9408 --- /dev/null +++ b/images/ruby/3.4.Dockerfile @@ -0,0 +1,53 @@ +ARG IMAGE_REPO +FROM ${IMAGE_REPO:-lagoon}/commons AS commons +FROM ruby:3.4.1-alpine3.21 + +ARG LAGOON_VERSION +ENV LAGOON_VERSION=$LAGOON_VERSION +LABEL org.opencontainers.image.authors="The Lagoon Authors" +LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images/blob/main/images/ruby/3.4.Dockerfile" +LABEL org.opencontainers.image.url="https://github.com/uselagoon/lagoon-images" +LABEL org.opencontainers.image.version="${LAGOON_VERSION}" +LABEL org.opencontainers.image.description="Ruby 3.4 image optimised for running in Lagoon in production and locally" +LABEL org.opencontainers.image.title="uselagoon/ruby-3.4" +LABEL org.opencontainers.image.base.name="docker.io/ruby:3.4-alpine3.21" + +ENV LAGOON=ruby + +# Copy commons files +COPY --from=commons /lagoon /lagoon +COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/wait-for /bin/ +COPY --from=commons /home /home + +RUN fix-permissions /etc/passwd \ + && mkdir -p /home + +RUN apk update \ + && apk add --no-cache tini \ + && rm -rf /var/cache/apk/* + +ENV TMPDIR=/tmp \ + TMP=/tmp \ + HOME=/home \ + # When Bash is invoked via `sh` it behaves like the old Bourne Shell and sources a file that is given in `ENV` + ENV=/home/.bashrc \ + # When Bash is invoked as non-interactive (like `bash -c command`) it sources a file that is given in `BASH_ENV` + BASH_ENV=/home/.bashrc + +RUN apk update \ + && apk add --no-cache --virtual .build-deps \ + build-base \ + && gem install webrick puma bundler \ + && apk del \ + .build-deps \ + && apk add --no-cache \ + rsync \ + tar \ + && rm -rf /var/cache/apk/* + +# Make sure shells are not running forever +COPY 80-shell-timeout.sh /lagoon/entrypoints/ +RUN echo "source /lagoon/entrypoints/80-shell-timeout.sh" >> /home/.bashrc + +ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"] +CMD ["ruby"]