-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
FROM heroku/heroku:22-build | ||
LABEL maintainer="[email protected]" | ||
|
||
ENV HOME=/app \ | ||
HEROKU_HOME=/heroku \ | ||
HEROKU_BUILDPACK_VERSION=22 \ | ||
# 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.2.4 \ | ||
# Check this file for NODE version: | ||
# https://github.com/heroku/heroku-buildpack-ruby/blob/main/lib/language_pack/helpers/nodebin.rb#L5 | ||
NODE_VERSION=20.9.0 \ | ||
# Check this file for YARN version: | ||
# https://github.com/heroku/heroku-buildpack-ruby/blob/main/lib/language_pack/helpers/nodebin.rb#L13 | ||
YARN_VERSION=1.22.19 | ||
|
||
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 ;\ | ||
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/* ;\ | ||
# fix bug when launching rails console | ||
ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6 ;\ | ||
#------------ | ||
# Install Ruby | ||
#------------ | ||
mkdir -p $HEROKU_HOME/ruby/ruby-$RUBY_VERSION ;\ | ||
curl -sL --retry 3 https://heroku-buildpack-ruby.s3.amazonaws.com/heroku-$HEROKU_BUILDPACK_VERSION/ruby-$RUBY_VERSION.tgz | tar xz -C $HEROKU_HOME/ruby/ruby-$RUBY_VERSION ;\ | ||
#------------ | ||
# Install Node | ||
#------------ | ||
curl -sL --retry 3 https://s3.amazonaws.com/heroku-nodebin/node/release/linux-x64/node-v$NODE_VERSION-linux-x64.tar.gz | tar xz -C $HEROKU_HOME/ruby/ ;\ | ||
mv $HEROKU_HOME/ruby/node-v$NODE_VERSION-linux-x64 $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/yarn-v$YARN_VERSION $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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --jobs 4 --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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters