Add default ruby images (#19)

This commit is contained in:
Will O'Beirne 2020-10-26 16:17:14 -05:00 committed by GitHub
parent 0008d972eb
commit 7a0b689530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,17 @@
FROM codercom/enterprise-base:centos
# Run everything as root
USER root
# Install OpenSSL library
RUN yum install -y openssl-devel
# Install Ruby from source
COPY ./install-ruby.sh /tmp
RUN chmod +x /tmp/install-ruby.sh && /tmp/install-ruby.sh
# Install bundler gem
RUN gem install bundler
# Set back to coder user
USER coder

View File

@ -0,0 +1,14 @@
FROM codercom/enterprise-base:ubuntu
# Run everything as root
USER root
# Install OpenSSL library
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y libssl-dev
# Install Ruby from source
COPY ./install-ruby.sh /tmp
RUN chmod +x /tmp/install-ruby.sh && /tmp/install-ruby.sh
# Set back to coder user
USER coder

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
RUBY_MAJOR=2.7
RUBY_VERSION=2.7.2
RUBY_SHA256=6e5706d0d4ee4e1e2f883db9d768586b4d06567debea353c796ec45e8321c3d4
RUBY_DOWNLOAD_PATH=/tmp/ruby.tar.gz
RUBY_SOURCE_DIR=/tmp/ruby-${RUBY_VERSION}
echo "Downloading Ruby ${RUBY_VERSION}..."
curl -fsSL -o ${RUBY_DOWNLOAD_PATH} https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR}/ruby-${RUBY_VERSION}.tar.gz
echo "Comparing downloaded file hash..."
echo "${RUBY_SHA256} ${RUBY_DOWNLOAD_PATH}" | sha256sum -c -
echo "Unzipping Ruby..."
tar -xzf $RUBY_DOWNLOAD_PATH -C /tmp
echo "Installing Ruby..."
pushd ${RUBY_SOURCE_DIR}
./configure
make
make install
popd