瀏覽代碼

Merge pull request #1412 from infosiftr/ruby-nonroot

Add a nonroot test to ruby
yosifkit 9 年之前
父節點
當前提交
f8fe033588

+ 2 - 1
test/config.sh

@@ -135,10 +135,11 @@ imageTests+=(
 	[rethinkdb]='
 	'
 	[ruby]='
+		ruby-hello-world
 		ruby-standard-libs
 		ruby-gems
 		ruby-bundler
-		ruby-hello-world
+		ruby-nonroot
 	'
 	[tomcat]='
 	'

+ 2 - 0
test/tests/ruby-nonroot/Gemfile

@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'advanced_math'

+ 1 - 0
test/tests/ruby-nonroot/container.sh

@@ -0,0 +1 @@
+../ruby-bundler/container.sh

+ 1 - 0
test/tests/ruby-nonroot/real-run.sh

@@ -0,0 +1 @@
+../ruby-bundler/run.sh

+ 16 - 0
test/tests/ruby-nonroot/run.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+set -eo pipefail
+
+dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
+
+image="$1"
+
+newImage="$("$dir/../image-name.sh" librarytest/ruby-nonroot "$image")"
+"$dir/../docker-build.sh" "$dir" "$newImage" <<EOD
+FROM $image
+USER nobody
+EOD
+
+docker run --rm "$newImage" gem install advanced_math
+
+exec "$dir/real-run.sh" "$newImage"

+ 1 - 1
test/tests/run-in-container.sh

@@ -39,7 +39,7 @@ if [ "$gemHome" ]; then
 	driver="$(docker info | awk -F ': ' '$1 == "Storage Driver" { print $2; exit }')"
 	if [ "$driver" = 'overlay' ]; then
 		# let's add a volume (_not_ a bind mount) on GEM_HOME to work around nokogiri+overlayfs issues
-		args+=( -v "$gemHome/gems" )
+		args+=( -v "$gemHome" )
 	fi
 fi