-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.build
52 lines (45 loc) · 2.1 KB
/
Dockerfile.build
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
46
47
48
49
50
51
52
FROM openjdk:8-jdk-slim
RUN \
apt-get update &&\
apt-get -y install git openssh-client
ENV SCALA_VERSION 2.12.10
RUN \
apt-get update &&\
apt-get install -qq -y curl gnupg2 apt-transport-https &&\
apt-get clean autoremove -y &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &&\
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
ENV SBT_VERSION 1.5.7
RUN \
curl -L -o sbt-$SBT_VERSION.deb https://repo.scala-sbt.org/scalasbt/debian/sbt-$SBT_VERSION.deb && \
dpkg -i sbt-$SBT_VERSION.deb && \
rm sbt-$SBT_VERSION.deb && \
apt-get update && \
apt-get -qq -y install sbt && \
apt-get clean &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &&\
sbt -Dsbt.rootdir=true -batch sbtVersion &&\
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
echo "case object Temp" > Temp.scala && \
sbt -Dsbt.rootdir=true -batch compile && \
rm -r project && rm build.sbt && rm Temp.scala && rm -r target
RUN apt-get update &&\
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common &&\
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - &&\
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" &&\
apt-get update &&\
apt-get install -y docker-ce docker-ce-cli containerd.io &&\
apt-get clean autoremove -y &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN adduser --home /var/lib/jenkins --disabled-password --gecos '' --uid 1000 jenkins
RUN mkdir /var/lib/jenkins/.ssh/ && \
ssh-keyscan github.com >> /var/lib/jenkins/.ssh/known_hosts && \
echo "Host *" >> /var/lib/jenkins/.ssh/config && \
echo " StrictHostKeyChecking no" >> /var/lib/jenkins/.ssh/config && \
echo " UserKnownHostsFile /dev/null" >> /var/lib/jenkins/.ssh/config && \
touch /var/lib/jenkins/.ssh/config
USER jenkins