Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit bb14be3

Browse files
authored
feat: Rebase on top of Ubuntu 20.04 (#221)
1 parent 39c67c7 commit bb14be3

23 files changed

Lines changed: 474 additions & 112 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/tmp
33
/ruby-base/Dockerfile
44
/ruby-prebuilt/Dockerfile
5+
/ruby-ubuntu*/Dockerfile

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ DEPENDENCIES
1818
rake (~> 12.0)
1919

2020
BUNDLED WITH
21-
2.1.4
21+
2.2.33

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ https://cloud.google.com/appengine/docs/flexible/ruby/
1212

1313
This repository includes:
1414

15-
* The base image atop Ubuntu 16_04, including the OS, common libraries and
16-
build dependencies, NodeJS, and rbenv, in the `ruby-ubuntu16` directory.
15+
* The base image atop Ubuntu 20_04, including the OS, common libraries and
16+
build dependencies, NodeJS, and rbenv, in the `ruby-ubuntu20` directory.
1717
* A Dockerfile and config for building Ruby binary images in the
1818
`ruby-prebuilt` directory.
1919
* A convenience image, including the above Ubuntu image and a default

Rakefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ BUNDLER2_VERSION="2.1.4"
2020
DEFAULT_RUBY_VERSION="2.7.6"
2121
NODEJS_VERSION="16.15.0"
2222
GCLOUD_VERSION="387.0.0"
23-
OS_NAME="ubuntu16"
23+
SSL10_VERSION="1.0.2n-1ubuntu5.9"
24+
OS_NAME="ubuntu20"
2425

25-
LOCAL_PREBUILT_RUBY_VERSIONS=["2.6.10", "2.7.6", "3.0.4", "3.1.1"]
26+
LOCAL_PREBUILT_RUBY_VERSIONS=["2.6.10", "2.7.6", "3.0.4", "3.1.2"]
2627
LOCAL_PREBUILT_RUBY_IMAGE_BASE="ruby-prebuilt-"
2728
LOCAL_PREBUILT_RUBY_IMAGE_TAG="latest"
2829
RELEASED_PREBUILT_RUBY_VERSIONS=::File.readlines("ruby-pipeline/ruby-latest.yaml")
@@ -48,19 +49,25 @@ end
4849
::ENV["PREBUILT_RUBY_IMAGE_TAG"] = PREBUILT_RUBY_IMAGE_TAG
4950
::ENV["BUNDLER1_VERSION"] = BUNDLER1_VERSION
5051
::ENV["BUNDLER2_VERSION"] = BUNDLER2_VERSION
52+
::ENV["TESTING_OS_NAME"] = OS_NAME
5153

5254
PREBUILT_RUBY_IMAGES = PREBUILT_RUBY_VERSIONS.map do |v|
5355
"#{v}=#{PREBUILT_RUBY_IMAGE_BASE}#{v}:#{PREBUILT_RUBY_IMAGE_TAG}"
5456
end.join(",")
5557

5658
require "rake/testtask"
5759

58-
desc "Build local docker image for ubuntu16 image"
59-
task "build:ubuntu16" do |t, args|
60-
sh "docker build --pull --no-cache -t ruby-ubuntu16" \
61-
" --build-arg bundler_version=#{BUNDLER2_VERSION}" \
62-
" --build-arg nodejs_version=#{NODEJS_VERSION}" \
63-
" ruby-ubuntu16"
60+
["ubuntu16", "ubuntu20"].each do |os_name|
61+
desc "Build local docker image for #{os_name} image"
62+
task "build:#{os_name}" do |t, args|
63+
sh "sed -e 's|@@IF_SSL10_DEV@@|#|g'" \
64+
" ruby-#{os_name}/Dockerfile.in > ruby-#{os_name}/Dockerfile"
65+
sh "docker build --pull --no-cache -t ruby-#{os_name}" \
66+
" --build-arg bundler_version=#{BUNDLER2_VERSION}" \
67+
" --build-arg nodejs_version=#{NODEJS_VERSION}" \
68+
" --build-arg ssl10_version=#{SSL10_VERSION}" \
69+
" ruby-#{os_name}"
70+
end
6471
end
6572

6673
desc "Build local docker image for current OS image"

build-ruby-binary-images.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -e
1919

2020
DIRNAME=$(dirname $0)
2121

22-
OS_NAME=ubuntu16
22+
OS_NAME=ubuntu20
2323
RUNTIME_NAME=ruby
2424
PROJECT=
2525
IMAGE_TAG=
@@ -38,7 +38,7 @@ show_usage() {
3838
echo ' -a <tag>: use this base image tag (defaults to `staging`)' >&2
3939
echo ' -c <versions>: comma separated prebuilt ruby versions (defaults to prebuilt-versions.txt)' >&2
4040
echo ' -n <name>: set the runtime name (defaults to `ruby`)' >&2
41-
echo ' -o <osname>: build against the given os base image (defaults to ubuntu16)' >&2
41+
echo ' -o <osname>: build against the given os base image (defaults to ubuntu20)' >&2
4242
echo ' -p <project>: set the project (defaults to current gcloud config setting)' >&2
4343
echo ' -s: also tag new images as `staging`' >&2
4444
echo ' -t <tag>: set the new image tag (creates a new tag if not provided)' >&2
@@ -111,6 +111,7 @@ if [ -z "${IMAGE_TAG}" ]; then
111111
fi
112112

113113
OS_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}
114+
OS_SSL10_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/ssl10
114115
PREBUILT_IMAGE_PREFIX=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/prebuilt/ruby-
115116

116117
echo
@@ -137,9 +138,14 @@ echo
137138
sed -e "s|@@RUBY_OS_IMAGE@@|ruby-${OS_NAME}|g" \
138139
< ${DIRNAME}/ruby-prebuilt/Dockerfile.in > ${DIRNAME}/ruby-prebuilt/Dockerfile
139140
for version in "${PREBUILT_VERSIONS[@]}"; do
141+
if [[ "${version}" < "2.4.0" ]]; then
142+
chosen_os_base_image=${OS_SSL10_BASE_IMAGE}
143+
else
144+
chosen_os_base_image=${OS_BASE_IMAGE}
145+
fi
140146
gcloud builds submit ${DIRNAME}/ruby-prebuilt \
141147
--config ${DIRNAME}/ruby-prebuilt/cloudbuild.yaml --project ${PROJECT} --timeout 20m \
142-
--substitutions _OS_NAME=${OS_NAME},_OS_BASE_IMAGE=${OS_BASE_IMAGE},_IMAGE=${PREBUILT_IMAGE_PREFIX}${version},_TAG=${IMAGE_TAG},_BASE_TAG=${BASE_IMAGE_TAG},_RUBY_VERSION=${version}
148+
--substitutions _OS_NAME=${OS_NAME},_OS_BASE_IMAGE=${chosen_os_base_image},_IMAGE=${PREBUILT_IMAGE_PREFIX}${version},_TAG=${IMAGE_TAG},_BASE_TAG=${BASE_IMAGE_TAG},_RUBY_VERSION=${version}
143149
echo "**** Built image: ${PREBUILT_IMAGE_PREFIX}${version}:${IMAGE_TAG}"
144150
if [ "${STAGING_FLAG}" = "true" ]; then
145151
gcloud container images add-tag --project ${PROJECT} \

build-ruby-runtime-images.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ BUNDLER1_VERSION=1.17.3
2424
BUNDLER2_VERSION=2.1.4
2525
NODEJS_VERSION=16.15.0
2626
GCLOUD_VERSION=387.0.0
27+
SSL10_VERSION=1.0.2n-1ubuntu5.9
2728

2829

2930
set -e
3031

3132
DIRNAME=$(dirname $0)
3233

33-
OS_NAME=ubuntu16
34+
OS_NAME=ubuntu20
3435
RUNTIME_NAME=ruby
3536
BASE_IMAGE_DOCKERFILE=default
3637
PROJECT=
@@ -43,7 +44,7 @@ show_usage() {
4344
echo 'Flags:' >&2
4445
echo ' -i: use prebuilt ruby to build base image' >&2
4546
echo ' -n <name>: set the runtime name (defaults to `ruby`)' >&2
46-
echo ' -o <osname>: build against the given os base image (defaults to `ubuntu16`)' >&2
47+
echo ' -o <osname>: build against the given os base image (defaults to `ubuntu20`)' >&2
4748
echo ' -p <project>: set the project (defaults to current gcloud config setting)' >&2
4849
echo ' -s: also tag new images as `staging`' >&2
4950
echo ' -t <tag>: set the new image tag (creates a new tag if not provided)' >&2
@@ -107,6 +108,7 @@ if [ -z "${IMAGE_TAG}" ]; then
107108
fi
108109

109110
OS_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}
111+
OS_SSL10_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/ssl10
110112
RUBY_BASIC_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/basic
111113
BUILD_TOOLS_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/build-tools
112114
GENERATE_DOCKERFILE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/generate-dockerfile
@@ -115,6 +117,9 @@ PREBUILT_IMAGE_PREFIX=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/prebuilt/ruby
115117
echo
116118
echo "Building base, tools, and dockerfile generator images:"
117119
echo " ${OS_BASE_IMAGE}:${IMAGE_TAG}"
120+
if [ "${OS_NAME}" != "ubuntu16" ]; then
121+
echo " ${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG}"
122+
fi
118123
echo " ${RUBY_BASIC_IMAGE}:${IMAGE_TAG}"
119124
echo " ${BUILD_TOOLS_IMAGE}:${IMAGE_TAG}"
120125
echo " ${GENERATE_DOCKERFILE_IMAGE}:${IMAGE_TAG}"
@@ -133,6 +138,22 @@ if [ -z "${AUTO_YES}" ]; then
133138
fi
134139
echo
135140

141+
if [ "${OS_NAME}" != "ubuntu16" ]; then
142+
sed -e "s|@@IF_SSL10_DEV@@||g" \
143+
< ${DIRNAME}/ruby-${OS_NAME}/Dockerfile.in > ${DIRNAME}/ruby-${OS_NAME}/Dockerfile
144+
gcloud builds submit ${DIRNAME}/ruby-${OS_NAME} \
145+
--config ${DIRNAME}/ruby-${OS_NAME}/cloudbuild.yaml --project ${PROJECT} \
146+
--substitutions _IMAGE=${OS_SSL10_BASE_IMAGE},_TAG=${IMAGE_TAG},_BUNDLER_VERSION=${BUNDLER2_VERSION},_NODEJS_VERSION=${NODEJS_VERSION},_SSL10_VERSION=${SSL10_VERSION}
147+
echo "**** Built image: ${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG}"
148+
if [ "${STAGING_FLAG}" = "true" ]; then
149+
gcloud container images add-tag --project ${PROJECT} \
150+
${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG} ${OS_SSL10_BASE_IMAGE}:staging -q
151+
echo "**** And tagged as ${OS_SSL10_BASE_IMAGE}:staging"
152+
fi
153+
fi
154+
155+
sed -e "s|@@IF_SSL10_DEV@@|#|g" \
156+
< ${DIRNAME}/ruby-${OS_NAME}/Dockerfile.in > ${DIRNAME}/ruby-${OS_NAME}/Dockerfile
136157
gcloud builds submit ${DIRNAME}/ruby-${OS_NAME} \
137158
--config ${DIRNAME}/ruby-${OS_NAME}/cloudbuild.yaml --project ${PROJECT} \
138159
--substitutions _IMAGE=${OS_BASE_IMAGE},_TAG=${IMAGE_TAG},_BUNDLER_VERSION=${BUNDLER2_VERSION},_NODEJS_VERSION=${NODEJS_VERSION}

build-ruby-runtime-pipeline.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -e
2020
DIRNAME=$(dirname $0)
2121

2222
UPLOAD_BUCKET=
23-
OS_NAME=ubuntu16
23+
OS_NAME=ubuntu20
2424
RUNTIME_NAME=ruby
2525
PROJECT=
2626
RUNTIME_VERSION=
@@ -41,7 +41,7 @@ show_usage() {
4141
echo ' -b <bucket>: upload a new runtime definition to this gcs bucket (required)' >&2
4242
echo ' -c <versions>: comma separated prebuilt ruby versions (defaults to prebuilt-versions.txt)' >&2
4343
echo ' -n <name>: set the runtime name (defaults to `ruby`)' >&2
44-
echo ' -o <osname>: use the given os base image (defaults to ubuntu16)' >&2
44+
echo ' -o <osname>: use the given os base image (defaults to ubuntu20)' >&2
4545
echo ' -p <project>: set the builder images project (defaults to current gcloud config setting)' >&2
4646
echo ' -r <version>: set the runtime release (defaults to create a new version)' >&2
4747
echo ' -s: also upload a staging runtime pipeline (defaults to false)' >&2

integration_test/builder_app/test.yaml.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
steps:
22
- name: '${STAGING_BUILDER_IMAGE}'
3-
args: ['--base-image', 'gcr.io/gcp-runtimes/ruby/ubuntu16:staging',
4-
'--build-tools-image', 'gcr.io/gcp-runtimes/ruby/ubuntu16/build-tools:staging',
5-
'--prebuilt-image', '2.6.6=gcr.io/gcp-runtimes/ruby/ubuntu16/prebuilt/ruby-2.6.6:latest',
6-
'--default-ruby-version', '2.6.6']
3+
args: ['--base-image', 'gcr.io/gcp-runtimes/ruby/ubuntu20:staging',
4+
'--build-tools-image', 'gcr.io/gcp-runtimes/ruby/ubuntu20/build-tools:staging',
5+
'--prebuilt-image', '3.1.2=gcr.io/gcp-runtimes/ruby/ubuntu20/prebuilt/ruby-3.1.2:latest',
6+
'--default-ruby-version', '3.1.2']
77
- name: 'gcr.io/cloud-builders/docker:latest'
88
args: ['build', '--network=cloudbuild', '-t', '${_OUTPUT_IMAGE}', '.']
99
images:

release-ruby-binary-images.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -e
1919

2020
DIRNAME=$(dirname $0)
2121

22-
OS_NAME=ubuntu16
22+
OS_NAME=ubuntu20
2323
RUNTIME_NAME=ruby
2424
PROJECT=
2525
IMAGE_TAG=staging
@@ -35,7 +35,7 @@ show_usage() {
3535
echo 'Flags:' >&2
3636
echo ' -c <versions>: comma separated prebuilt ruby versions (defaults to prebuilt-versions.txt)' >&2
3737
echo ' -n <name>: set the runtime name (defaults to `ruby`)' >&2
38-
echo ' -o <osname>: build against the given os base image (defaults to ubuntu16)' >&2
38+
echo ' -o <osname>: build against the given os base image (defaults to ubuntu20)' >&2
3939
echo ' -p <project>: set the project (defaults to current gcloud config setting)' >&2
4040
echo ' -t <tag>: the image tag to release (defaults to `staging`)' >&2
4141
echo ' -y: automatically confirm' >&2

release-ruby-runtime-images.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -e
1919

2020
DIRNAME=$(dirname $0)
2121

22-
OS_NAME=ubuntu16
22+
OS_NAME=ubuntu20
2323
RUNTIME_NAME=ruby
2424
PROJECT=
2525
IMAGE_TAG=staging
@@ -29,7 +29,7 @@ show_usage() {
2929
echo 'Usage: release-ruby-runtime-images.sh [flags...]' >&2
3030
echo 'Flags:' >&2
3131
echo ' -n <name>: set the runtime name (defaults to `ruby`)' >&2
32-
echo ' -o <osname>: build against the given os base image (defaults to ubuntu16)' >&2
32+
echo ' -o <osname>: build against the given os base image (defaults to ubuntu20)' >&2
3333
echo ' -p <project>: set the project (defaults to current gcloud config setting)' >&2
3434
echo ' -t <tag>: the image tag to release (defaults to `staging`)' >&2
3535
echo ' -y: automatically confirm' >&2
@@ -79,13 +79,17 @@ if [ -z "${PROJECT}" ]; then
7979
fi
8080

8181
OS_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}
82+
OS_SSL10_BASE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/ssl10
8283
RUBY_BASIC_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/basic
8384
BUILD_TOOLS_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/build-tools
8485
GENERATE_DOCKERFILE_IMAGE=gcr.io/${PROJECT}/${RUNTIME_NAME}/${OS_NAME}/generate-dockerfile
8586

8687
echo
8788
echo "Releasing (i.e. tagging as latest) runtime images:"
8889
echo " ${OS_BASE_IMAGE}:${IMAGE_TAG}"
90+
if [ "${OS_NAME}" != "ubuntu16" ]; then
91+
echo " ${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG}"
92+
fi
8993
echo " ${RUBY_BASIC_IMAGE}:${IMAGE_TAG}"
9094
echo " ${BUILD_TOOLS_IMAGE}:${IMAGE_TAG}"
9195
echo " ${GENERATE_DOCKERFILE_IMAGE}:${IMAGE_TAG}"
@@ -104,6 +108,13 @@ gcloud container images add-tag --project ${PROJECT} \
104108
${OS_BASE_IMAGE}:latest -q
105109
echo "**** Tagged image ${OS_BASE_IMAGE}:${IMAGE_TAG} as latest"
106110

111+
if [ "${OS_NAME}" != "ubuntu16" ]; then
112+
gcloud container images add-tag --project ${PROJECT} \
113+
${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG} \
114+
${OS_SSL10_BASE_IMAGE}:latest -q
115+
echo "**** Tagged image ${OS_SSL10_BASE_IMAGE}:${IMAGE_TAG} as latest"
116+
fi
117+
107118
gcloud container images add-tag --project ${PROJECT} \
108119
${RUBY_BASIC_IMAGE}:${IMAGE_TAG} \
109120
${RUBY_BASIC_IMAGE}:latest -q

0 commit comments

Comments
 (0)