Skip to content

Instantly share code, notes, and snippets.

@joakimk
Last active February 25, 2021 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joakimk/854d190bb8423a807ac1f696925443cd to your computer and use it in GitHub Desktop.
Save joakimk/854d190bb8423a807ac1f696925443cd to your computer and use it in GitHub Desktop.
Building custom ruby images to use the latest versions (e.g. to get security fixes earlier)

Building custom ruby-alpine

Check the alpine version of the previous image.

alpine3.9 master$ docker run -it ruby:2.5.4-alpine sh
/ # cat /etc/alpine-release 
3.9.2
/ # ruby -v
ruby 2.5.4p155 (2019-03-13 revision 67245) [x86_64-linux-musl]

Clone the official repo.

git clone https://github.com/docker-library/ruby.git
cd 2.5/alpine3.9
cat Dockerfile|grep 'ENV RUBY_VERSION'

Edit Dockerfile if needed to the correct version. Then build and push to your own account.

docker build . -t foo/ruby:x.x.x-alpine
docker push foo/ruby:x.x.x-alpine

Verify and compare to the previous version above.

alpine3.9 master$ docker run -it foo/ruby:x.x.x-alpine sh
/ # cat /etc/alpine-release 
3.9.2
/ # ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-musl]

Done!

For CircleCI you can do a similar thing with https://github.com/circleci/circleci-images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment