Skip to content

Commit

Permalink
feat: Add 3.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jfloff committed Jan 18, 2025
1 parent db406f8 commit 84ffb40
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- 24-3.3.4
- 24-3.3.5
- 24-3.3.6
- 24-3.3.7
steps:
# Checkout this repo
# https://github.com/actions/checkout
Expand Down
101 changes: 101 additions & 0 deletions 24-3.3.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM heroku/heroku:24-build
LABEL maintainer="[email protected]"

USER root
ENV HOME=/app \
HEROKU_HOME=/heroku \
HEROKU_BUILDPACK_VERSION=24 \
# The versions are updated according to Heroku Ruby Buildpack
# Check this file for RUBY version:
# https://github.com/heroku/heroku-buildpack-ruby/blob/main/lib/language_pack/ruby_version.rb#L16
RUBY_VERSION=3.3.7 \
# Check this file for NODE version:
# https://github.com/heroku/heroku-buildpack-ruby/blob/main/lib/language_pack/helpers/nodebin.rb#L4
NODE_VERSION=22.11.0 \
# Check this file for YARN version:
# https://github.com/heroku/heroku-buildpack-ruby/blob/main/lib/language_pack/helpers/nodebin.rb#L5
YARN_VERSION=1.22.22

ENV PATH=$HOME/bin:$HEROKU_HOME/ruby/bundle/ruby/$RUBY_VERSION/bin:$HEROKU_HOME/ruby/ruby-$RUBY_VERSION/bin:$HEROKU_HOME/ruby/node-$NODE_VERSION/bin:$HEROKU_HOME/ruby/yarn-$YARN_VERSION/bin:${PATH} \
# so no interactions happen while installing packages
DEBIAN_FRONTEND=noninteractive \
# Bundler variables
GEM_PATH=$HEROKU_HOME/ruby/bundle/ruby/$RUBY_VERSION \
GEM_HOME=$HEROKU_HOME/ruby/bundle/ruby/$RUBY_VERSION \
BUNDLE_APP_CONFIG=$HEROKU_HOME/ruby/.bundle/config

# set the locale of the application
# this is useful for rails console handling UTF8 characters
ARG LOCALE="en_US.UTF-8"
ENV LANG=$LOCALE \
LC_COLLATE=$LOCALE \
LC_CTYPE=$LOCALE \
LC_MESSAGES=$LOCALE \
LC_MONETARY=$LOCALE \
LC_NUMERIC=$LOCALE \
LC_TIME=$LOCALE \
LC_ALL=$LOCALE

# Copy init script
COPY ./init.sh /usr/bin/init.sh

RUN set -ex ;\
export ARCH=$(dpkg --print-architecture) ;\
mkdir -p $HOME ;\
#------------
# Remove existing ruby
#------------
dpkg --purge --force-depends ruby ;\
#------------
# Install extra dependencies
#------------
apt-get update && apt-get install -y --no-install-recommends \
tzdata \
tree \
# needed to download https gems
libssl-dev \
# for rails rspec
busybox \
# utils
inetutils-ping \
vim \
; \
rm -rf /var/lib/apt/lists/* ;\
#------------
# Install Ruby
#------------
# url ref: https://github.com/heroku/heroku-buildpack-ruby/blob/main/bin/support/download_ruby#L32
mkdir -p $HEROKU_HOME/ruby/ruby-$RUBY_VERSION ;\
curl -sL --retry 3 https://heroku-buildpack-ruby.s3.amazonaws.com/heroku-$HEROKU_BUILDPACK_VERSION/$ARCH/ruby-$RUBY_VERSION.tgz | tar xz -C $HEROKU_HOME/ruby/ruby-$RUBY_VERSION ;\
#------------
# Install Node
#------------
# node archictures has different matches -- this just covers our 2 platforms (arm64 and amd64)
case "$ARCH" in \
amd64) NODE_ARCH='x64' ;;\
*) NODE_ARCH="$ARCH" ;;\
esac ;\
curl -sL --retry 3 https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$NODE_ARCH.tar.xz | tar xJ -C $HEROKU_HOME/ruby/ ;\
mv $HEROKU_HOME/ruby/node-v$NODE_VERSION-linux-$NODE_ARCH $HEROKU_HOME/ruby/node-$NODE_VERSION ;\
#------------
# Install Yarn
#------------
curl -sL --retry 3 https://s3.amazonaws.com/heroku-nodebin/yarn/release/yarn-v$YARN_VERSION.tar.gz | tar xz -C $HEROKU_HOME/ruby/ ;\
mv $HEROKU_HOME/ruby/package $HEROKU_HOME/ruby/yarn-$YARN_VERSION ;\
#------------
# Set startup script
#------------
chmod +x /usr/bin/init.sh

#------------
# Install application and its gems
#------------
WORKDIR $HOME
ONBUILD ADD . $HOME
ONBUILD RUN set -ex ;\
# force bundle to use github https protocol
bundle config github.https true
# avoid installing gems here so we give a chance for child images to install any dependency
# eg. SQLite3 extension

ENTRYPOINT ["/usr/bin/init.sh"]
29 changes: 29 additions & 0 deletions 24-3.3.7/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# just keep going if we don't have anything to install
set +e

# set BUNDLER_VERSION env variable in case we need it
if [ -f Gemfile.lock ]; then
GEMFILE_LOCK_BUNDLE_VERSION=$(awk '/BUNDLED WITH/{getline; print}' Gemfile.lock)
fi

# if any changes to Gemfile occur between runs (e.g. if you mounted the
# host directory in the container), it will install changes before proceeding
if [ -f Gemfile ]; then
bundle check || bundle install --retry 3
fi

if [ "$RAILS_ENV" == "production" ]; then
bundle exec rake assets:precompile
fi

if test -f "$HOME/.profile"; then
set -x;
source $HOME/.profile;
{ set +x; } 2>/dev/null
fi

set -e

exec "$@"
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Docker container for Rails based on the Heroku base images.
* `24-3.3.4` *[(22-3.3.4/Dockerfile)](24-3.3.4/Dockerfile)*
* `24-3.3.5` *[(22-3.3.5/Dockerfile)](24-3.3.5/Dockerfile)*
* `24-3.3.6` *[(22-3.3.6/Dockerfile)](24-3.3.6/Dockerfile)*
* `24-3.3.7` *[(22-3.3.7/Dockerfile)](24-3.3.7/Dockerfile)*

_Tag format: `<Heroku Buildpack version>-<Ruby version>`_

Expand Down Expand Up @@ -54,12 +55,6 @@ This container comes with a [post-run script](init.sh) that:
Subsequent runs will use cached changes. This is useful to avoid you from (1) having to rebuild the images each time there is a change on your Gemfile, (2) from having to run a shell just to deploy pending migrations, and (3) to precompile assets if you want to test production mode.


### Changelog
* 2023/12/29: Change organization to flecto-io
* 2023/04/10: Remove copy of entire app folder into container. Copy only Gemfile to install bundler.
* 2021/11/01: Change image ownership to Rnters organization. Upgrade to Heroku 20 build image.


### License

MIT (see LICENSE file)

0 comments on commit 84ffb40

Please sign in to comment.