This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
forked from sbt/docker-sbt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
45 lines (38 loc) · 1.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# Scala and sbt Dockerfile
#
# https:/AlexisChevalier/unprivileged-scala-sbt
#
# Pull base image
FROM openjdk:11.0.1
# Env variables
ENV SCALA_VERSION 2.12.8
ENV SBT_VERSION 1.2.7
# Install Scala
## Piping curl directly in tar
RUN \
curl -fsL https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \
echo >> /root/.bashrc && \
echo "export PATH=~/scala-$SCALA_VERSION/bin:$PATH" >> /root/.bashrc
# Install sbt
RUN \
curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \
dpkg -i sbt-$SBT_VERSION.deb && \
rm sbt-$SBT_VERSION.deb && \
apt-get update && \
apt-get install -y sbt sudo && \
sbt sbtVersion && \
mkdir project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
echo "case object Temp" > Temp.scala && \
sbt compile && \
rm -r project && rm build.sbt && rm Temp.scala && rm -r target
#Create user
RUN useradd -ms /bin/bash sbtuser
RUN adduser sbtuser sudo
RUN echo 'sbtuser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-sbtuser
USER sbtuser
# Define working directory
WORKDIR /home/sbtuser
RUN sbt sbtVersion