Skip to content

Commit

Permalink
Merge pull request #1214 from uselagoon/ruby34
Browse files Browse the repository at this point in the history
build: add Ruby 3.4 images
  • Loading branch information
tobybellwood authored Jan 20, 2025
2 parents 4ed276c + cdbe4e1 commit 16e5f09
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions helpers/TESTING_base_images_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions helpers/images-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
53 changes: 53 additions & 0 deletions images/ruby/3.4.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 16e5f09

Please sign in to comment.