Skip to content

Instantly share code, notes, and snippets.

@doppiomacchiatto
Forked from mohnoor94/installScala.txt
Last active August 28, 2023 15:00
Show Gist options
  • Save doppiomacchiatto/c29fa5cacd87be0a43bd4f04ccd2c212 to your computer and use it in GitHub Desktop.
Save doppiomacchiatto/c29fa5cacd87be0a43bd4f04ccd2c212 to your computer and use it in GitHub Desktop.
Install Scala and SBT using apt on Ubuntu or any Debian derivative using apt
## Install Java
RUN apt update
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME #New Docker feature, we are copying the SDK from another Docker Image
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# Install Scala
RUN apt remove scala-library scala
RUN wget --no-verbose -O http://scala-lang.org/files/archive/scala-2.13.1.deb
RUN dpkg -i scala-2.13.1.deb
# Install SBT
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" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
RUN chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && apt update && apt install -y sbt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment