Skip to content

Instantly share code, notes, and snippets.

@mfittko
Forked from uyorum/Dockerfile
Last active April 13, 2023 06:28
Show Gist options
  • Save mfittko/e60e42948d3ca428e26cb198937e8056 to your computer and use it in GitHub Desktop.
Save mfittko/e60e42948d3ca428e26cb198937e8056 to your computer and use it in GitHub Desktop.
Dockerfile for AWS CodeBuild with Ruby 3.2.2
# Start with the AWS CodeBuild standard image
FROM public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:4.0 as builder
RUN yum install -y git make gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel && \
git clone https://github.com/rbenv/ruby-build.git && \
PREFIX=/usr/local ./ruby-build/install.sh
ARG RUBY_VERSION
ENV RUBY_VERSION=${RUBY_VERSION:-3.2.2}
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION}
RUN /usr/local/bin/ruby-build ${RUBY_VERSION} ${RUBY_DIR}
FROM public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:4.0
RUN yum install -y openssl libyaml libffi readline zlib gdbm ncurses
ARG RUBY_VERSION
ENV RUBY_VERSION=${RUBY_VERSION:-3.2.2}
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION}
COPY --from=builder ${RUBY_DIR} ${RUBY_DIR}
ENV GEM_HOME=/tmp/gems
VOLUME ${GEM_HOME}
ENV PATH=/tmp/gems/bin:${RUBY_DIR}/bin:${PATH}
CMD irb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment