Skip to content

Commit

Permalink
Adding scala and sbt to the image, setting SCALA_HOME and also mappin…
Browse files Browse the repository at this point in the history
…g the scala cache folders to the shared folder
  • Loading branch information
neomatrix369 committed Sep 30, 2021
1 parent b7033ce commit 2025341
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,13 @@ java-kotlin-aot/helloworld
java-kotlin-aot/helloworld.build_artifacts.txt
shared
micronaut-nativeimage/hello/
micronaut-webapp/loadTests/results-*
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
17 changes: 15 additions & 2 deletions docker-images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions runDockerImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 2025341

Please sign in to comment.