Skip to content

Commit dc4e316

Browse files
committed
Change docker setup
- Use `coursier setup` to install sbt and other Scala tools - Manually install recent versions of Gradle and Maven - Only install Java 17 by default
1 parent 015c65d commit dc4e316

File tree

3 files changed

+44
-25
lines changed

3 files changed

+44
-25
lines changed

bin/docker-setup.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -eux
3+
curl -fL https://github.com/coursier/coursier/releases/download/v2.1.0-RC5/cs-x86_64-pc-linux-static.gz | gzip -d > cs
4+
chmod +x cs
5+
./cs setup --yes --jvm 17 --architecture amd64
6+
7+
curl -fLo gradle.zip https://services.gradle.org/distributions/gradle-7.6-bin.zip
8+
unzip -d /opt/gradle gradle.zip
9+
10+
curl -fLo maven.zip https://dlcdn.apache.org/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.zip
11+
unzip -d /opt/maven maven.zip
12+
13+
rm gradle.zip maven.zip cs

build.sbt

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -232,42 +232,48 @@ lazy val cli = project
232232
),
233233
docker / dockerfile := {
234234
val binaryDistribution = pack.value
235-
val script = (ThisBuild / baseDirectory).value / "bin" /
235+
val scipJavaWrapper = (ThisBuild / baseDirectory).value / "bin" /
236236
"scip-java-docker-script.sh"
237+
val dockerSetup = (ThisBuild / baseDirectory).value / "bin" /
238+
"docker-setup.sh"
237239
new Dockerfile {
238-
from("gradle:7.2.0-jdk8")
240+
from("ubuntu:latest")
239241

240242
// Setup system dependencies.
241243
run("apt-get", "update")
242-
run("apt-get", "install", "--yes", "maven", "jq")
243-
244-
// Install Coursier.
245244
run(
245+
"apt-get",
246+
"install",
247+
"--yes",
248+
"jq",
249+
"wget",
246250
"curl",
247-
"-fLo",
248-
"/usr/local/bin/coursier",
249-
"https://github.com/coursier/launchers/raw/master/coursier"
251+
"zip",
252+
"unzip",
253+
"git",
254+
// C++ and Python dependencies that may be needed by some random JVM
255+
// builds.
256+
"python3",
257+
"python3-pip",
258+
"autoconf",
259+
"automake",
260+
"libtool",
261+
"build-essential",
262+
"libtool",
263+
"make",
264+
"g++"
250265
)
251-
run("chmod", "+x", "/usr/local/bin/coursier")
252266

253-
// Pre-download Java 8, 11 and 17.
254-
run("coursier", "java-home", "--jvm", "8")
255-
run("coursier", "java-home", "--jvm", "11")
256-
run("coursier", "java-home", "--jvm", "17")
267+
// Install SDKMAN
268+
add(dockerSetup, "/docker-setup.sh")
269+
run("bash", "/docker-setup.sh")
257270

258-
// Install `sbt`
259-
run(
260-
"curl",
261-
"-fLo",
262-
"sbt.zip",
263-
"https://github.com/sbt/sbt/releases/download/v1.8.2/sbt-1.8.2.zip"
264-
)
265-
run("unzip", "sbt.zip")
266-
run("rm", "sbt.zip")
267-
run("ln", "-sfv", "/home/gradle/sbt/bin/sbt", "/usr/local/bin/sbt")
271+
env("PATH", "/opt/maven/maven-3.8.7/bin:${PATH}")
272+
env("PATH", "/opt/gradle/gradle-7.6/bin:${PATH}")
273+
env("PATH", "/root/.local/share/coursier/bin:${PATH}")
268274

269275
// Install `scip-java` binary.
270-
add(script, "/usr/local/bin/scip-java")
276+
add(scipJavaWrapper, "/usr/local/bin/scip-java")
271277
add(binaryDistribution, "/app/scip-java")
272278
}
273279
}

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.14")
2-
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2")
2+
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.9.0")
33
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
44
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
55
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

0 commit comments

Comments
 (0)