Skip to content

Commit

Permalink
Upgrade Ruby to 2.6.3 (forem#2649)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhymes authored and maestromac committed May 2, 2019
1 parent 96a0235 commit 56e13d0
Show file tree
Hide file tree
Showing 13 changed files with 166 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.6.3
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cache:
- node_modules
- $HOME/.nvm
rvm:
- 2.6.1
- 2.6.3
addons:
postgresql: '9.6'
chrome: stable
Expand Down
210 changes: 103 additions & 107 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#####################################################
#
# Alpine container with
# Alpine container with
# (this is used in DEV mode)
#
# + ruby:2.6.1
#
# + ruby:2.6.3
# + node:8.15.0
# + yarn:1.12.3
#
Expand All @@ -13,123 +13,119 @@ FROM node:8.15.1-alpine AS alpine-ruby-node
#------------------------------------------------------------------------------------------
#
# Ruby installation, taken from the official ruby alpine dockerfile
# see : https://github.com/docker-library/ruby/blob/96fc06fb331a20ba823ecc11563a99d1eb94203f/2.6/alpine3.9/Dockerfile
# see : https://github.com/docker-library/ruby/blob/9ae0943fa2935b3a13c72ae7d6afa2439145d7fa/2.6/alpine3.9/Dockerfile
#
#------------------------------------------------------------------------------------------

RUN apk add --no-cache \
gmp-dev
gmp-dev

# skip installing gem documentation
RUN mkdir -p /usr/local/etc \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc

ENV RUBY_MAJOR 2.6
ENV RUBY_VERSION 2.6.1
ENV RUBY_DOWNLOAD_SHA256 47b629808e9fd44ce1f760cdf3ed14875fc9b19d4f334e82e2cf25cb2898f2f2
ENV RUBYGEMS_VERSION 3.0.3
ENV RUBY_VERSION 2.6.3
ENV RUBY_DOWNLOAD_SHA256 11a83f85c03d3f0fc9b8a9b6cad1b2674f26c5aaa43ba858d4b0fcc2b54171e1

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
# readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
RUN set -ex \
\
&& apk add --no-cache --virtual .ruby-builddeps \
autoconf \
bison \
bzip2 \
bzip2-dev \
ca-certificates \
coreutils \
dpkg-dev dpkg \
gcc \
gdbm-dev \
glib-dev \
libc-dev \
libffi-dev \
libxml2-dev \
libxslt-dev \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
procps \
readline-dev \
ruby \
tar \
xz \
yaml-dev \
zlib-dev \
\
&& wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \
\
&& mkdir -p /usr/src/ruby \
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
&& rm ruby.tar.xz \
\
&& cd /usr/src/ruby \
\
# https://github.com/docker-library/ruby/issues/196
# https://bugs.ruby-lang.org/issues/14387#note-13 (patch source)
# https://bugs.ruby-lang.org/issues/14387#note-16 ("Therefore ncopa's patch looks good for me in general." -- only breaks glibc which doesn't matter here)
&& wget -O 'thread-stack-fix.patch' 'https://bugs.ruby-lang.org/attachments/download/7081/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch' \
&& echo '3ab628a51d92fdf0d2b5835e93564857aea73e0c1de00313864a94a6255cb645 *thread-stack-fix.patch' | sha256sum -c - \
&& patch -p1 -i thread-stack-fix.patch \
&& rm thread-stack-fix.patch \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
&& { \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new \
&& mv file.c.new file.c \
\
&& autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
# the configure script does not detect isnan/isinf as macros
&& export ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
&& ./configure \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
&& make -j "$(nproc)" \
&& make install \
\
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --no-network --virtual .ruby-rundeps $runDeps \
bzip2 \
ca-certificates \
libffi-dev \
procps \
yaml-dev \
zlib-dev \
&& apk del --no-network .ruby-builddeps \
&& cd / \
&& rm -r /usr/src/ruby \
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
&& ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))' \
&& gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/ \
# rough smoke test
&& ruby --version && gem --version && bundle --version
\
&& apk add --no-cache --virtual .ruby-builddeps \
autoconf \
bison \
bzip2 \
bzip2-dev \
ca-certificates \
coreutils \
dpkg-dev dpkg \
gcc \
gdbm-dev \
glib-dev \
libc-dev \
libffi-dev \
libxml2-dev \
libxslt-dev \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
procps \
readline-dev \
ruby \
tar \
xz \
yaml-dev \
zlib-dev \
\
&& wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \
\
&& mkdir -p /usr/src/ruby \
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
&& rm ruby.tar.xz \
\
&& cd /usr/src/ruby \
\
# https://github.com/docker-library/ruby/issues/196
# https://bugs.ruby-lang.org/issues/14387#note-13 (patch source)
# https://bugs.ruby-lang.org/issues/14387#note-16 ("Therefore ncopa's patch looks good for me in general." -- only breaks glibc which doesn't matter here)
&& wget -O 'thread-stack-fix.patch' 'https://bugs.ruby-lang.org/attachments/download/7081/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch' \
&& echo '3ab628a51d92fdf0d2b5835e93564857aea73e0c1de00313864a94a6255cb645 *thread-stack-fix.patch' | sha256sum -c - \
&& patch -p1 -i thread-stack-fix.patch \
&& rm thread-stack-fix.patch \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
&& { \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new \
&& mv file.c.new file.c \
\
&& autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
# the configure script does not detect isnan/isinf as macros
&& export ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
&& ./configure \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
&& make -j "$(nproc)" \
&& make install \
\
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --no-network --virtual .ruby-rundeps $runDeps \
bzip2 \
ca-certificates \
libffi-dev \
procps \
yaml-dev \
zlib-dev \
&& apk del --no-network .ruby-builddeps \
&& cd / \
&& rm -r /usr/src/ruby \
# rough smoke test
&& ruby --version && gem --version && bundle --version

# install things globally, for great justice
# and don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
# path recommendation: https://github.com/bundler/bundler/pull/6469#issuecomment-383235438
ENV PATH $GEM_HOME/bin:$BUNDLE_PATH/gems/bin:$PATH
# adjust permissions of a few directories for running "gem install" as an arbitrary user
Expand Down Expand Up @@ -163,7 +159,7 @@ ENV RAILS_ENV development
#
# This allow us to modify the docker
# entrypoint / run file without recompiling
# the entire application
# the entire application
# (especially when creating this buidl script =| )
#
# (@TODO - improve and review ignore to blacklist unneded items)
Expand Down Expand Up @@ -212,11 +208,11 @@ COPY Dockerfile [(docker-)]* /usr/src/app/
# Execution environment variables
#

# timeout extension requried to ensure
# timeout extension requried to ensure
# system work properly on first time load
ENV RACK_TIMEOUT_WAIT_TIMEOUT=10000 \
RACK_TIMEOUT_SERVICE_TIMEOUT=10000 \
STATEMENT_TIMEOUT=10000
ENV RACK_TIMEOUT_WAIT_TIMEOUT=10000 \
RACK_TIMEOUT_SERVICE_TIMEOUT=10000 \
STATEMENT_TIMEOUT=10000

# Run mode configuration between dev / demo
# for entrypoint script behaviour
Expand All @@ -226,7 +222,7 @@ ENV RUN_MODE="demo"
ENV DATABASE_URL="postgresql://devto:devto@db:5432/PracticalDeveloper_development"

# DB setup / migrate script triggers on boot
ENV DB_SETUP="true" \
ENV DB_SETUP="true" \
DB_MIGRATE="true"

#
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "https://rubygems.org"
ruby "2.6.1"
ruby "2.6.3"

# Enforce git to transmitted via https.
# workaround until bundler 2.0 is released.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ DEPENDENCIES
zonebie (~> 0.6.1)

RUBY VERSION
ruby 2.6.1p33
ruby 2.6.3p62

BUNDLED WITH
1.17.3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<br/>
<p align="center">
<a href="https://www.ruby-lang.org/en/">
<img src="https://img.shields.io/badge/Ruby-v2.6.1-green.svg" alt="ruby version"/>
<img src="https://img.shields.io/badge/Ruby-v2.6.3-green.svg" alt="ruby version"/>
</a>
<a href="http://rubyonrails.org/">
<img src="https://img.shields.io/badge/Rails-v5.2.3-brightgreen.svg" alt="rails version"/>
Expand Down
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

3.times do
Organization.create!(
name: Faker::SiliconValley.company,
name: Faker::TvShows::SiliconValley.company,
summary: Faker::Company.bs,
remote_profile_image_url: logo = Faker::Company.logo,
nav_image: logo,
Expand Down
4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ then
echo ">---"
echo "> [dev.to/docker-entrypoint.sh] DEV mode"
echo "> "
echo "> Welcome to the dev.to, DEVELOPMENT container, for convinence your repository"
echo "> Welcome to the dev.to, DEVELOPMENT container, for convenience your repository"
echo "> should be mounted onto '/usr/src/app/', and port 3000 should be forwarded to your host machine"
echo "> "
echo "> In addition the following alias commands has been preconfigured to get you up and running quickly"
Expand All @@ -49,7 +49,7 @@ echo "> Time to rock & roll"
echo ">---"

#
# DB setup
# DB setup
# note this will fail (intentionally), if DB was previously setup
#
if [[ "$DB_SETUP" == "true" ]]
Expand Down
14 changes: 7 additions & 7 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ then
echo "| For this container to work, we will need at minimum ALGOLIA API keys"
echo "| For logins to work, we will need either GITHUB or TWITTER API keys"
echo "|"
echo "| See ( https://docs.dev.to/get-api-keys-dev-env/ ) "
echo "| See ( https://docs.dev.to/getting-started/config-env/ ) "
echo "| for instructions on how to get the various API keys "
echo "|"
echo "| Once you got your various API keys, please proceed to the next step"
Expand Down Expand Up @@ -114,7 +114,7 @@ fi

###########################################
#
# Script header guide
# Script header guide
#
###########################################

Expand All @@ -140,12 +140,12 @@ echo "#"
echo "# RUN_MODE can either be the following"
echo "#"
echo "# - 'DEV' : Start up the container into bash, with a quick start guide"
echo "# - 'DEMO' : Start up the container, and run dev.to (requries ALGOLIA environment variables)"
echo "# - 'DEMO' : Start up the container, and run dev.to (requires ALGOLIA environment variables)"
echo "# - 'RESET-DEV' : Resets postgresql and upload data directory for a clean deployment, before running as DEV mode"
echo "# - 'RESET-DEMO' : Resets postgresql and upload data directory for a clean deployment, before running as DEMO mode"
echo "# - 'INTERACTIVE-DEMO' : Runs this script in 'interactive' mode to setup the 'DEMO'"
echo "#"
echo "# So for example to run a development container in bash its simply"
echo "# So for example to run a development container in bash it's simply"
echo "# './docker-run.sh DEV'"
echo "#"
echo "# To run a simple demo, with some dummy data (replace <?> with the actual keys)"
Expand Down Expand Up @@ -439,7 +439,7 @@ mkdir -p "$UPLOAD_DIR"
#
# in DEV mode - lets run in interactive mode
#
if [ "$RUN_MODE" = "DEV" ]
if [ "$RUN_MODE" = "DEV" ]
then
docker run -it -p 3000:3000 \
--name dev-to-app \
Expand Down Expand Up @@ -472,7 +472,7 @@ dev-to:demo
# this waits up to ~20*30 seconds
#
echo "#---"
echo "# Waiting for dev.to server... "
echo "# Waiting for dev.to server... "
echo "#"
echo "# this commonly takes 2 ~ 10 minutes, basically, a very long time .... =[ "

Expand Down Expand Up @@ -506,7 +506,7 @@ echo "$DOCKER_INFO" | grep dev-to-
# Finishing message
#
echo "#---"
echo "# Container deployed on port ( http://localhost:3000 )"
echo "# Container deployed on address ( http://localhost:3000 )"
echo "# "
echo "# Time to dev.to(gether)"
echo "#---"
Loading

0 comments on commit 56e13d0

Please sign in to comment.