From 202534166886783d9ff19818af7669e2e6e4e9a5 Mon Sep 17 00:00:00 2001 From: Mani Sarkar Date: Thu, 30 Sep 2021 17:44:41 +0100 Subject: [PATCH] Adding scala and sbt to the image, setting SCALA_HOME and also mapping the scala cache folders to the shared folder --- .gitignore | 11 ++++++++++- docker-images/Dockerfile | 17 +++++++++++++++-- runDockerImage.sh | 19 ++++++++++++++++--- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f356d794c..c368d1bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -237,4 +237,13 @@ java-kotlin-aot/helloworld java-kotlin-aot/helloworld.build_artifacts.txt shared micronaut-nativeimage/hello/ -micronaut-webapp/loadTests/results-* \ No newline at end of file +micronaut-webapp/loadTests/results-* +mn-python/env/ +functionGraphDemo/Rplot001.svg +native-netty-plot/netty-plot.build_artifacts.txt +native-netty-plot/src/main/resources/META-INF/native-image/* +polyglot-javascript-java-r/Rplot001.svg +polyglot-javascript-java-r/package-lock.json +spring-r/Rplot001.svg +scala-examples/scalac-native/project/ +scala-examples/scalac-native/scalac.build_artifacts.txt \ No newline at end of file diff --git a/docker-images/Dockerfile b/docker-images/Dockerfile index fe5b1b142..58c97a856 100644 --- a/docker-images/Dockerfile +++ b/docker-images/Dockerfile @@ -10,9 +10,22 @@ RUN echo; echo " --- Micronaut version"; mn --version; echo COPY --from=workload-generator/wrk /tmp/wrk/wrk /usr/local/bin RUN echo "Testing 'wrk':"; wrk || true -# Install smaller utilities needed during building of image in the slim image +# Install other smaller utilities needed during building of image in the slim image RUN echo; echo "--- Installing wget, curl, vim, unzip in the slim image"; echo -RUN apt-get update && apt-get install -yq --no-install-recommends wget curl vim unzip +RUN apt-get update && apt-get install -yq --no-install-recommends \ + wget curl vim unzip gnupg2 + +# Install scala and sbt +# See https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html +RUN echo; echo "--- Installing scala and sbt in the slim image"; echo +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list +RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add +RUN apt-get update && apt-get install -yq --no-install-recommends scala sbt +RUN echo "Scala version:"; scala -help; echo +RUN echo "sbt version:"; sbt --version; echo +ENV SCALA_HOME="/usr/share/scala" # this maps to the specific vesion of Scala for e.g. scala-2.11 +RUN echo; echo "SCALA_HOME=${SCALA_HOME}"; echo # Setup GraalVM paths ARG GRAALVM_HOME diff --git a/runDockerImage.sh b/runDockerImage.sh index 9266f6b56..96f1bcdc0 100755 --- a/runDockerImage.sh +++ b/runDockerImage.sh @@ -29,18 +29,31 @@ GRADLE_REPO_ON_HOST="${SHARED_FOLDER}/_dot_gradle_folder" echo; echo "-- Creating/using folder '${GRADLE_REPO_ON_HOST}' mounted as '.gradle' folder inside the container (${GRADLE_REPO_INSIDE_CONTAINER})" mkdir -p ${GRADLE_REPO_ON_HOST} +SBT_REPO_INSIDE_CONTAINER="/root/.sbt/" +SBT_REPO_ON_HOST="${SHARED_FOLDER}/_dot_sbt_folder" +echo; echo "-- Creating/using folder '${SBT_REPO_ON_HOST}' mounted as '.sbt' folder inside the container (${SBT_REPO_INSIDE_CONTAINER})" +mkdir -p ${SBT_REPO_ON_HOST} + +IVY_REPO_INSIDE_CONTAINER="/root/.ivy2/" +IVY_REPO_ON_HOST="${SHARED_FOLDER}/_dot_ivy_folder" +echo; echo "-- Creating/using folder '${IVY_REPO_ON_HOST}' mounted as '.ivy*' folder inside the container (${IVY_REPO_INSIDE_CONTAINER})" +mkdir -p ${IVY_REPO_ON_HOST} + echo; echo "--- Running docker image for GraalVM version ${FULL_GRAALVM_VERSION} for ${WORKDIR}"; echo docker run --rm \ --interactive --tty \ --volume $(pwd):${WORKDIR} \ --volume "${M2_ON_HOST}":${M2_INSIDE_CONTAINER} \ --volume "${GRADLE_REPO_ON_HOST}":${GRADLE_REPO_INSIDE_CONTAINER} \ + --volume "${SBT_REPO_ON_HOST}":${SBT_REPO_INSIDE_CONTAINER} \ + --volume "${IVY_REPO_ON_HOST}":${IVY_REPO_INSIDE_CONTAINER} \ --workdir ${WORKDIR} \ --env GRAALVM_HOME=${GRAALVM_HOME_FOLDER} \ --entrypoint /bin/bash \ - -p 8888:8888 \ - -p 8088:8088 \ - -p 8080:8080 \ + -p 3000:3000 \ -p 8081:8081 \ + -p 8080:8080 \ + -p 8088:8088 \ -p 8443:8443 \ + -p 8888:8888 \ ${FULL_DOCKER_TAG_NAME}:${FULL_GRAALVM_VERSION} \ No newline at end of file