Skip to content

Commit

Permalink
initial dockerfiles for openjdk 8u222, openjfx 8, sbt 1.3.0 and scala…
Browse files Browse the repository at this point in the history
… 2.13.0
  • Loading branch information
sergiorussia committed Sep 7, 2019
1 parent 0e826ab commit 826b91a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# docker-openjdk-javafx-sbt
Docker files for OpenJDK with JavaFX and SBT
Docker files for OpenJDK with JavaFX and SBT. Inspired by https://github.com/hseeberger/scala-sbt/ but simpler and is primarily intented for **building** your projects, eg CI and so on.

There are three options:
- image-amazon = [Amazon Corretto](https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/docker-install.html) (which already includes OpenJFX) + SBT
- image-debian = pure Debian + OpenJDK JDK + OpenJFX + SBT, **recommended**
- image-openjdk = similar to image-debian but based on official openjdk image, however OpenJFX installation is hacky
25 changes: 25 additions & 0 deletions image-amazon/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Amazon Corretto 8 provides JavaFX out-of-the-box
FROM amazoncorretto:8u222

# The following is inspired by https://github.com/hseeberger/scala-sbt/blob/master/oracle/Dockerfile
ENV SCALA_VERSION 2.13.0
ENV SBT_VERSION 1.3.0

# Install sbt
RUN \
curl -L -o /root/sbt-${SBT_VERSION}.rpm https://bintray.com/sbt/rpm/download_file?file_path=sbt-${SBT_VERSION}.rpm && \
yum install -y /root/sbt-${SBT_VERSION}.rpm && \
yum clean all && \
rm /root/sbt-${SBT_VERSION}.rpm

# Prepare sbt and Scala, verify compilation including JavaFX classes
WORKDIR /root/dummy
RUN \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
echo -e 'import java.nio.file.Path\nimport javafx.application.Application\ncase object Temp' > Temp.scala && \
sbt compile && \
rm -rf /root/dummy

WORKDIR /root
25 changes: 25 additions & 0 deletions image-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Debian Stretch provides proper openjfx version for Java 8
FROM buildpack-deps:stretch-scm

# Install OpenJDK JDK and OpenJFX
RUN apt-get update && apt-get install -y --no-install-recommends openjdk-8-jdk openjfx && rm -rf /var/lib/apt/lists/*

# The following is inspired by https://github.com/hseeberger/scala-sbt/blob/master/debian/Dockerfile
ENV SCALA_VERSION 2.13.0
ENV SBT_VERSION 1.3.0
RUN \
curl -L -o /root/sbt-${SBT_VERSION}.deb https://dl.bintray.com/sbt/debian/sbt-${SBT_VERSION}.deb && \
apt-get install -y /root/sbt-${SBT_VERSION}.deb && \
rm /root/sbt-${SBT_VERSION}.deb

# Prepare sbt and Scala, verify compilation including JavaFX classes
WORKDIR /root/dummy
RUN \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
echo 'import java.nio.file.Path\nimport javafx.application.Application\ncase object Temp' > Temp.scala && \
sbt compile && \
rm -rf /root/dummy

WORKDIR /root
30 changes: 30 additions & 0 deletions image-openjdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Debian Stretch provides proper openjfx version for Java 8
FROM openjdk:8u222-jdk-stretch

# Install OpenJFX as per https://github.com/docker-library/openjdk/issues/158
RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/*

# The following is inspired by https://github.com/hseeberger/scala-sbt/blob/master/debian/Dockerfile
ENV SCALA_VERSION 2.13.0
ENV SBT_VERSION 1.3.0
RUN \
curl -L -o /root/sbt-${SBT_VERSION}.deb https://dl.bintray.com/sbt/debian/sbt-${SBT_VERSION}.deb && \
apt-get install -y /root/sbt-${SBT_VERSION}.deb && \
rm /root/sbt-${SBT_VERSION}.deb

# Fix OpenJFX installation for local JDK
RUN \
ln -s -t "$JAVA_HOME/jre/lib/" $(find /usr/share/java/openjfx/jre/lib/ -maxdepth 1 -type f) && \
ln -s -t "$JAVA_HOME/jre/lib/ext/" $(find /usr/share/java/openjfx/jre/lib/ext/ -maxdepth 1 -type f)

# Prepare sbt and Scala, verify compilation including JavaFX classes
WORKDIR /root/dummy
RUN \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
echo 'import java.nio.file.Path\nimport javafx.application.Application\ncase object Temp' > Temp.scala && \
sbt compile && \
rm -rf /root/dummy

WORKDIR /root

0 comments on commit 826b91a

Please sign in to comment.