This is an automated email from the ASF dual-hosted git repository.
rskraba pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new 3dbf0a040 AVRO-3736: [Ruby] Preinstall gems in ubertool docker (#2191)
3dbf0a040 is described below
commit 3dbf0a04094a926b82616c3e88308da092cf7b58
Author: Ryan Skraba <[email protected]>
AuthorDate: Thu May 25 21:37:58 2023 +0200
AVRO-3736: [Ruby] Preinstall gems in ubertool docker (#2191)
* AVRO-3736: [Ruby] Preinstall gems in ubertool docker
* Replicate expected directory structure
Co-authored-by: Tim Perkins <[email protected]>
* AVRO-3736: Update from PR comments
---------
Co-authored-by: Tim Perkins <[email protected]>
---
build.sh | 8 ++++++--
share/docker/Dockerfile | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/build.sh b/build.sh
index 52ee9cd30..0bd1e1880 100755
--- a/build.sh
+++ b/build.sh
@@ -56,6 +56,9 @@ DOCKER_BUILD_XTRA_ARGS=${DOCKER_BUILD_XTRA_ARGS-}
# Override the docker image name used.
DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME-}
+# When building a docker container, these are the files that will sent and
available.
+DOCKER_EXTRA_CONTEXT="lang/ruby/Gemfile lang/ruby/avro.gemspec
lang/ruby/Manifest share/VERSION.txt"
+
usage() {
echo "Usage: $0 {lint|test|dist|sign|clean|veryclean|docker [--args
\"docker-args\"]|rat|githooks|docker-test}"
exit 1
@@ -300,8 +303,9 @@ do
echo "RUN getent group $GROUP_ID || groupadd -g $GROUP_ID $USER_NAME"
echo "RUN getent passwd $USER_ID || useradd -g $GROUP_ID -u $USER_ID
-k /root -m $USER_NAME"
} > Dockerfile
+ # Include the ruby gemspec for preinstallation.
# shellcheck disable=SC2086
- tar -cf- lang/ruby/Gemfile Dockerfile | docker build
$DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
+ tar -cf- Dockerfile $DOCKER_EXTRA_CONTEXT | docker build
$DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
rm Dockerfile
# By mapping the .m2 directory you can do an mvn install from
# within the container and use the result on your normal
@@ -336,7 +340,7 @@ do
;;
docker-test)
- tar -cf- share/docker/Dockerfile lang/ruby/Gemfile |
+ tar -cf- share/docker/Dockerfile $DOCKER_EXTRA_CONTEXT |
docker build -t avro-test -f share/docker/Dockerfile -
docker run --rm -v "${PWD}:/avro${DOCKER_MOUNT_FLAG}" --env
"JAVA=${JAVA:-8}" avro-test /avro/share/docker/run-tests.sh
;;
diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile
index 7d916035f..b67747f57 100644
--- a/share/docker/Dockerfile
+++ b/share/docker/Dockerfile
@@ -179,6 +179,12 @@ RUN python3 -m pip install --upgrade pip setuptools wheel \
# Install Ruby
RUN apt-get -qqy install ruby-full \
&& apt-get -qqy clean
+RUN mkdir -p /tmp/lang/ruby/lib/avro && mkdir -p /tmp/share
+COPY lang/ruby/* /tmp/lang/ruby/
+COPY share/VERSION.txt /tmp/share/
+RUN gem install bundler --no-document && \
+ apt-get install -qqy libyaml-dev && \
+ cd /tmp/lang/ruby && bundle install
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
--default-toolchain 1.60.0