Giter Club home page Giter Club logo

docker-sbt's Introduction

Scala and sbt Dockerfile

This repository provides Scala and sbt Docker files and images.

As we think referencing unstable versions is a bad idea we don't publish a latest tag. Our tags consists of three parts: <JDK version>_<sbt version>_<Scala version>.

Images are updated daily

Available JDK base images:

  • eclipse-temurin
  • graalvm-ce

Where to get images

The images are published at Docker Hub

For a list of all available tags see https://hub.docker.com/r/sbtscala/scala-sbt/tags

Older tags are available at: https://hub.docker.com/r/hseeberger/scala-sbt/tags

Installation

  1. Install Docker
  2. Pull automated build from public Docker Hub Registry:
docker pull sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.1_3.2.0

Alternatively, you can build an image from the remote Dockerfile:

docker build \
  --build-arg BASE_IMAGE_TAG="17.0.4.1_1-jdk" \
  --build-arg SBT_VERSION="1.7.1" \
  --build-arg SCALA_VERSION="3.2.0" \
  --build-arg USER_ID=1001 \
  --build-arg GROUP_ID=1001 \
  -t sbtscala/scala-sbt \
  "github.com/sbt/docker-sbt.git#:eclipse-temurin"

Usage

docker run -it --rm sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.1_3.2.0

Alternative commands

The container contains bash, scala and sbt.

docker run -it --rm sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.1_3.2.0 scala

Non-root

The container is prepared to be used with a non-root user called sbtuser

docker run -it --rm -u sbtuser -w /home/sbtuser sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.1_3.2.0

Contribution policy

Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.

License

This code is open source software licensed under the Apache 2.0 License.

docker-sbt's People

Contributors

aaabramov avatar adericbourg avatar alexarchambault avatar alexbalonperin avatar btomala avatar burnsjake avatar carbrex avatar christiankniep avatar danirey avatar dbronecki avatar dependabot[bot] avatar duncancrawford avatar edrevo avatar eperinan avatar fcv avatar fehu avatar fgrutsch avatar fitztrev avatar fokko avatar fpopic avatar francisdb avatar hseeberger avatar jhnsmth avatar kadekm avatar kijuky avatar ksisu avatar leonardehrenfried avatar nightscape avatar tomahna avatar valencik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-sbt's Issues

Build for multiple Java base images

There are a lot of PRs upgrading (e.g. to Java 12) or even downgrading (back to Java 8) the Java version. There's also the wish for using a slim variant of the Java base image.

Therefore I'd like to enable the build to support multiple Java base images. Yet I do not know how to achieve that and I'm looking for help.

Add docker client to the image?

Hello and thanks for maintaining this image

I use it with all of my CI builds to run tests with testcontainers and to build docker images with sbt-native-packager plugin. Until recently I didn't need to install docker in the image because I could use system docker by mounting it as hostPath volume.
With recent docker updates you can't just mount the docker binary anymore to use it inside a container, so I wonder if it's worthwhile to include docker client binaries with the scala-sbt image? Perhaps it could be a "variant" image ("scala-sbt:docker" or somesuch)?

Tag inconsistencies

Hi, I had a really weird issue where the docker tags listed in Docker Hub seem wrong. The latest tag listed is 8u212_2.13.0_1.2.8 but when I curl the repository curl -L -s 'https://registry.hub.docker.com/v2/repositories/hseeberger/scala-sbt/tags?page_size=100'|jq '."results"[]["name"]' the latest is listed as 8u212_1.2.8_2.13.0.

When I use the tag 8u212_1.2.8_2.13.0 I can pull, but if I use latest or 8u212_2.13.0_1.2.8 it fails.

Image for building rpm

Hi, i'm wondering if there is an image that i could use to build rpm using sbt native packager plugin? I thought hseeberger/scala-sbt:11.0.2-oraclelinux7_1.3.12_2.13.2 would work because it's red hat based distro, but it doesn't:
[error] java.io.IOException: Cannot run program "rpmbuild" (in directory "/opt/teamcity-agent/work/568b3d2ec6bdf2ae/my_project/target/rpm/SPECS"): error=2, No such file or directory

Missing 8u181_2.12.8_1.2.8

Hi ๐Ÿ‘‹
Thank you for this image! Would it be possible to publish 8u181_2.12.8_1.2.8? We use those Scala/Sbt versions with Java 8 and we would like to avoid downloading sbt from scratch in our CI.

Thank you!

PR #63 introduced two regressions

@DaniRey your PR #63 introduced two regressions:

  • sbt is no longer "prepared", it needs to download itself on startup
  • scala is no longer on the path

I think this is due to still using the directory root in some places, e.g. in
echo "export PATH=~/scala-$SCALA_VERSION/bin:$PATH" >> /root/.bashrc.

Could you please take a look and fix that?

Scala 3 broken on oraclelinux

 > [ 3/10] RUN   case 3.0.0-RC2 in     "3"*) URL=https://github.com/lampepfl/dotty/releases/download/3.0.0-RC2/scala3-3.0.0-RC2.tar.gz SCALA_DIR=/usr/share/scala3-3.0.0-RC2 ;;     *) URL=https://downloads.typesafe.com/scala/3.0.0-RC2/scala-3.0.0-RC2.tgz SCALA_DIR=/usr/share/scala-3.0.0-RC2 ;;   esac &&   curl -fsL $URL | tar xfz - -C /usr/share &&   mv $SCALA_DIR /usr/share/scala &&   chown -R root:root /usr/share/scala &&   chmod -R 755 /usr/share/scala &&   ln -s /usr/share/scala/bin/* /usr/local/bin &&   case 3.0.0-RC2 in     "3"*) echo "@main def main = println(util.Properties.versionMsg)" > test.scala ;;     *) echo "println(util.Properties.versionMsg)" > test.scala ;;   esac &&   scala test.scala && rm test.scala:
#6 4.980 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.982 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.984 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.987 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.989 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.992 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.994 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.997 /usr/share/scala/bin/common: line 136: find: command not found
#6 4.999 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.002 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.004 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.007 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.010 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.032 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.034 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.037 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.041 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.044 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.047 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.049 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.052 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.056 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.058 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.061 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.063 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.065 /usr/share/scala/bin/common: line 136: find: command not found
#6 5.352 Error: Could not find or load main class dotty.tools.scripting.Main
#6 5.352 Caused by: java.lang.ClassNotFoundException: dotty.tools.scripting.Main

republish openjdk:11.0.1 based images?

It looks like the openjdk:11.0.1 image used to be based on the debian sid image, but has at some point been republished based on the debian stretch image.

Proof:

> docker run --rm hseeberger/scala-sbt:11.0.1_2.12.8_1.2.7 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux buster/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

> docker run --rm openjdk:11.0.1 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Would it be possible to rebuild (with a clear docker build cache!) and republish the images in this repo that are jdk11-based (or at least just the latest tag)?

please support openjdk 14

Hi,

Would you please add support for it ?

I had success on my test environment with this base image : adoptopenjdk/openjdk14:jdk-14.0.2_12-slim but I'd be happy with any java 14 runtime.

Tag images in docker hub

Could you start tagging the images in dockerhub, so we can avoid using "latest"? (to guarantee reproducibility when we create images from yours). Thanks.

Github Actions can no longer build scala-sbt:11.0.1_2.12.7_1.2.6

Hello.
And first of all thanks for your work on this Docker image, it helps us working with Scala easily ๐Ÿ‘
As said in title though, Github Actions can no longer build it from sources, starting few days ago but probably unrelated to the new version you provided. There seems to be an error accessing the ScalaSbt or Maven repos involving the trustAnchors parameter that prevent sbt-1.2.6 being downloaded.
I reproduced locally trying to build from this tag.
I'll try to find a fix but I wanted to let you know. This seems related to the issue.
Excerpt from the logs:

	Server access Error: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/1.2.6/ivys/ivy.xml

	Server access Error: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/1.2.6/ivys/ivy.xml


:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;1.2.6: not found
Error during sbt execution: Error retrieving required libraries

Multi-arch support (buildx)

Hi, thanks so much for this. I was wondering if there is any plan to have multi-arch support (not super familiar with this, I've just discovered here) for arm (Apple M1) compatibility (without rosetta).

Thanks

Slim variant as base image?

Right now version 11.0.1_2.12.8_1.2.7 weighs in at 697 MB. The size is mainly due to the base image.

Each openjdk docker image flavour comes in a "slim" variant which is a lot smaller. That means that only the bare essentials of the Debian packages are installed.

Would you accept a pull request to change the base image to 11.0.1-jdk-slim? Right now this image weighs in at 330 MB.

Latest tag is missing

docker pull hseeberger/scala-sbt fails due to the latest tag not being present on docker hub.

scala not in $PATH

When running the images for java 11, sbt 1.3.0 and scala 2.13.x with the following commands:

docker run -it --rm -u sbtuser -w /home/sbtuser hseeberger/scala-sbt:11.0.4_1.3.0_2.13.1 scala
or
docker run -it --rm -u sbtuser -w /home/sbtuser hseeberger/scala-sbt:11.0.4_1.3.0_2.13.0 scala

I get the error message that there is no executable found in $PATH for scala. Running those commands as root (without the options -u and -w does not work either).

Also building another image with these as base images and running which scala gives an exit code of 1.

graalvm images are bloated

Partly because of the base image but also because chown -R /opt creates a new layer that reintroduces 900MB of files. (The numbers shown on docker hub are only half the size because of compression.)

building image

When I build the image myself using the suggested docker build -t hseeberger/scala-sbt github.com/hseeberger/scala-sbt and then run it, I get a jshell prompt instead of the bash prompt I get when running the canned image. I'm new to docker and probably doing something wrong, but what?

using 8u212_2.12.8_1.2.8 fails with Permission denied

I get the following exception:

java.io.FileNotFoundException: /builds/tegonal/scala-steward/sbt-cache/boot/sbt.boot.lock (Permission denied)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
	at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
	at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
	at xsbt.boot.Locks$.apply0(Locks.scala:31)
	at xsbt.boot.Locks$.apply(Locks.scala:28)
	at xsbt.boot.Launch.locked(Launch.scala:238)
	at xsbt.boot.Launch.app(Launch.scala:147)
	at xsbt.boot.Launch.app(Launch.scala:145)
	at xsbt.boot.Launch$.run(Launch.scala:102)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:56)
	at xsbt.boot.Boot$.main(Boot.scala:18)
	at xsbt.boot.Boot.main(Boot.scala)

Using 8u181_2.12.8_1.2.8 in the same setup works

Set default executable to sbt instead of jshell

> docker run -it hseeberger/scala-sbt:15.0.2_1.5.0_2.13.5
May 03, 2021 6:15:56 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
|  Welcome to JShell -- Version 15.0.2
|  For an introduction type: /help intro

`apt-get update` fails with E: Could not open file

Hey, I have been successfully using your image in a Bitbucket pipeline:

image: hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8

As of recently, the build fails while executing the apt-get update command:

+ apt-get update
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch-backports InRelease [91.8 kB]
Get:5 http://deb.debian.org/debian stretch Release [118 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2434 B]
Get:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [492 kB]
Get:8 http://deb.debian.org/debian stretch-updates/main amd64 Packages.diff/Index [9592 B]
Get:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages [31.7 kB]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages.diff/Index [27.8 kB]
Get:10 http://deb.debian.org/debian stretch-backports/main amd64 Packages.diff/Index [27.8 kB]
Get:11 http://deb.debian.org/debian stretch-backports/main amd64 Packages [596 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 Packages [7082 kB]
Reading package lists...
E: Could not open file /var/lib/apt/lists/deb.debian.org_debian_dists_stretch-backports_main_binary-amd64_Packages.diff_Index - open (2: No such file or directory)

Do you have any idea what might have broken this?

JDK 11

We would like to move on the JDK 11.
We're using your image so I've done a pull request with the necessary changes.

:latest missing

Hi,

I just realized that my automated build failed due to the missing "latest" docker image.

docker pull hseeberger/scala-sbt:latest
Error response from daemon: manifest for hseeberger/scala-sbt:latest not found

sbt 1.3.x coursier cache not shared

Sbt 1.3.x uses coursier instead of ivy, coursier stores it's cache at ~/.cache/coursier and that folder is currently not being shared between the root and sbtuser user.

So currently a build using the default root user will not make use of the prefetched libs.

[Internal] load build context

I have a multistage Docker build; here is the relevant part of that file.

FROM node:14 AS vue-builder
RUN mkdir -p /usr/client-ui
WORKDIR /usr/client-ui
COPY client/ui/package.json /usr/client-ui/
RUN npm install
COPY client/ui /usr/client-ui
RUN npm run build

FROM hseeberger/scala-sbt:11.0.11_1.5.3_2.13.6 AS scala-builder
RUN mkdir -p /usr
WORKDIR /usr
COPY . /usr
COPY --from=vue-builder /usr/client-ui/dist ./public/
RUN sbt client/dist

...

but running it on Windows produces the following error:

error from sender: open client\target\streams\_global\assemblyOption\_global\streams\assembly\0a94896a5ea2f8e42101b8156972ca3f4522a922_5d9f3d441f99d721b957e3497f0a6465c764fad4_da39a3ee5e6b4b0d3255bfef95601890afd80709\com\fasterxml\jackson\databind: Access is denied.

Incidentally running it within WSL seems to work.

I've checked that it's definitely hseeberger/scala-sbt that's causing the error and I've tried multiple other tags with the same result. Any idea what's happening?

sbt: command not found

Getting error when running container

docker run -ti --rm hseeberger/scala-sbt:graalvm-ce-20.0.0-java11_1.3.12_2.12.11 /bin/sh
sh-4.2# sbt sbtVersion
sh: sbt: command not found

caching of jars

if you want the sbt (and scala-library) jars to be downloaded in this image, you'd be best doing something like https://github.com/ensime/ensime-docker/blob/v1.x/Dockerfile#L48-L55

  mkdir -p project src/main/scala &&\
  touch src/main/scala/scratch.scala &&\
  for SBT_VERSION in $SBT_VARIANTS ; do\
    echo "sbt.version=$SBT_VERSION" > project/build.properties &&\
    for SCALA_VERSION in $SCALA_VARIANTS ; do\
      sbt ++$SCALA_VERSION clean updateClassifiers compile ;\
    done ;\
  done

Support for Java 16

Are you open to adding support for Java 16 to the build matrix? The baseImageTag would be 16-jdk-buster.

javac not found, found Java 8 expected 11

Hi, I am using the tag 11.0.3_1.2.8_2.12.9 to switch to open JDK 11 from 8
But after installing it, I got confronted by

java.io.IOException: Cannot run program "javac" (in directory "/www/war/backend"): error=2, No such file or directory

I can't find this one. But what is more surprising is this:

war@712acceb888e:/www/war$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1~deb9u1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Erroring pulling latest release

Getting an error while doing a docker pull of the latest release,

Error response from daemon: manifest for hseeberger/scala-sbt:8u212_2.13.0_1.2.8 not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.