Skip to content

Commit f146bf9

Browse files
authored
dynamic JAVA_HOME (#12)
1 parent 0e7a17e commit f146bf9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docker_compose/test_container_entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# if JAVA_HOME is not set, just default to /usr (works if /usr/bin/java exists)
1617
if [[ -z "$JAVA_HOME" ]]; then
1718
JAVA_HOME="/usr"
19+
# this is used if JAVA_HOME contains an * (if version changes regularly this can be useful)
20+
elif [[ "$JAVA_HOME" == *"\*"* ]]; then
21+
JAVA_HOME=$(find $JAVA_HOME -maxdepth 1 | head -n 1)
1822
fi
1923

2024
TEST_UBER_JAR=$(find ./ -maxdepth 1 -name '*_uber_jar_deploy.jar')

examples/junit-image-test/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ services:
1717
test_container:
1818
image: junit-image-test:test_container
1919
entrypoint: ["/busybox/sh", "./test_container_entrypoint.sh"]
20+
environment:
21+
- JAVA_HOME=/usr/

0 commit comments

Comments
 (0)