-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We shouldn't need Ruby installed on the runner, and again the container just to be able to build Ruby versions. This commit moves functionality that doesn't **need** to be in Ruby to bash. This is needed as ruby/setup-ruby does not currently work with ARM ruby/setup-ruby#577.
- Loading branch information
Showing
9 changed files
with
157 additions
and
87 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
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,17 @@ | ||
FROM heroku/heroku:24-build | ||
|
||
USER root | ||
|
||
# setup workspace | ||
RUN rm -rf /tmp/workspace | ||
RUN mkdir -p /tmp/workspace | ||
|
||
RUN apt-get update -y; apt-get install ruby -y | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
# output dir is mounted | ||
|
||
ADD build.rb /tmp/build.rb | ||
COPY lib/ /tmp/lib/ | ||
CMD ["ruby", "/tmp/build.rb", "/tmp/workspace", "/tmp/output", "/tmp/cache"] |
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
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
BASE_IMAGE=$1 | ||
if [ -z "$BASE_IMAGE" ] | ||
then | ||
echo "Base image argument is requied i.e. 'heroku-24'" | ||
exit 1 | ||
fi | ||
|
||
cp "dockerfiles/Dockerfile.$BASE_IMAGE" Dockerfile | ||
|
||
docker build -t hone/ruby-builder:$BASE_IMAGE . |
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
BASE_IMAGE=$1 | ||
VERSION=$2 | ||
|
||
if [ -z "$BASE_IMAGE" ] | ||
then | ||
echo "Base image argument is requied i.e. 'heroku-24'" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$VERSION" ] | ||
then | ||
echo "Version is required i.e. '3.2.3" | ||
exit 1 | ||
fi | ||
|
||
echo "Building Ruby $VERSION on $BASE_IMAGE" | ||
|
||
OUTPUT_DIR=${OUTPUT_DIR:-`pwd`/builds} | ||
CACHE_DIR=${CACHE_DIR:-`pwd`/cache} | ||
|
||
docker run -v $OUTPUT_DIR:/tmp/output -v $CACHE_DIR:/tmp/cache -e VERSION="$VERSION" -e STACK=$BASE_IMAGE hone/ruby-builder:$BASE_IMAGE |
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,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
VERSION=$1 | ||
|
||
if [ -z "$VERSION" ] | ||
then | ||
echo "Version is required i.e. '3.2.3" | ||
exit 1 | ||
fi | ||
|
||
echo "Add a changelog item: https://devcenter.heroku.com/admin/changelog_items/new" | ||
echo | ||
|
||
cat <<EOM | ||
## Ruby version ruby-$VERSION is now available | ||
[Ruby v$VERSION](/articles/ruby-support#ruby-versions) is now available on Heroku. To run | ||
your app using this version of Ruby, add the following \`ruby\` directive to your Gemfile: | ||
\`\`\`ruby | ||
ruby "$VERSION" | ||
\`\`\` | ||
For more information on [Ruby #{parts.download_format}, you can view the release announcement](https://www.ruby-lang.org/en/news/). | ||
EOM |
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,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
BASE_IMAGE=$1 | ||
VERSION=$2 | ||
ARCH=$3 | ||
|
||
if [ -z "$BASE_IMAGE" ] | ||
then | ||
echo "Base image argument is requied i.e. 'heroku-24'" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$VERSION" ] | ||
then | ||
echo "Version is required i.e. '3.2.3" | ||
exit 1 | ||
fi | ||
|
||
echo "Printing gem version for Ruby $VERSION on $BASE_IMAGE" | ||
|
||
if [ -z "$ARCH" ]; then | ||
echo "ARCH is not set" | ||
ruby_tar_file="$BASE_IMAGE/ruby-$VERSION.tgz" | ||
else | ||
echo "Using arch '$ARCH'" | ||
ruby_tar_file="$BASE_IMAGE/$ARCH/ruby-$VERSION.tgz" | ||
fi | ||
|
||
docker run -v $(pwd)/builds:/tmp/output hone/ruby-builder:$BASE_IMAGE bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/$ruby_tar_file -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v" |