forked from joshgarnett/docker-alpine-sbt
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
77 lines (61 loc) · 2.77 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM frolvlad/alpine-glibc:alpine-3.7
# Set environment
ENV JAVA_HOME /usr/lib/jvm/jdk8
ENV PATH $PATH:$JAVA_HOME/bin
RUN apk add --no-cache --virtual=build-dependencies wget ca-certificates \
&& mkdir /usr/lib/jvm
WORKDIR /usr/lib/jvm
# Install JDK8 as the default JDK
RUN wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz -O - | gunzip | tar x \
&& ls \
&& test -e /usr/lib/jvm/jdk1.8.0_162 \
&& ln -s /usr/lib/jvm/jdk1.8.0_162 /usr/lib/jvm/jdk8
# Install JDK7 as an optional JDK
RUN wget http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/jdk-7u80-linux-x64.tar.gz -O - | gunzip | tar x \
&& ls \
&& test -e /usr/lib/jvm/jdk1.7.0_80 \
&& ln -s /usr/lib/jvm/jdk1.7.0_80 /usr/lib/jvm/jdk7
# Install JDK9 as an optional JDK
RUN wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz -O - | gunzip | tar x \
&& ls \
&& test -e /usr/lib/jvm/jdk-9.0.4 \
&& ln -s /usr/lib/jvm/jdk-9.0.4 /usr/lib/jvm/jdk9
WORKDIR /
# Set environment
ENV UNDERLYING_SBT /usr/lib/bin/sbt
# Install packages
RUN apk add --no-cache bash
RUN apk add --no-cache --virtual=build-dependencies wget ca-certificates
RUN apk add --no-cache git
RUN apk add --no-cache openssh
RUN apk add --no-cache curl
RUN apk add --no-cache jq
RUN apk add --no-cache ruby
RUN apk add --no-cache ruby-bundler ruby-dev ruby-irb ruby-rdoc libatomic readline readline-dev \
libxml2 libxml2-dev libxslt libxslt-dev zlib-dev zlib libffi-dev build-base nodejs
RUN apk add --no-cache hugo
# Install jekyll and sass just in case they are required
RUN export PATH="/root/.rbenv/bin:$PATH"
RUN gem update --system
RUN gem install sass
RUN gem install jekyll
RUN mkdir /usr/lib/bin
RUN curl -s https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt > /usr/lib/bin/sbt
RUN chmod 0755 /usr/lib/bin/sbt
# Add all scripts in image
COPY bin /usr/local/bin
COPY sbt.boot /sbt.boot
# Copy our custom sbt to the default location, replace previous
RUN mv /usr/local/bin/sbt /usr/bin/sbt
RUN $UNDERLYING_SBT about -sbt-create -Dsbt.boot.properties=/sbt.boot
# Remove dependencies
RUN apk del build-dependencies
RUN apk del build-base zlib-dev ruby-dev readline-dev libffi-dev libxml2-dev
# Set up and warm up sbt
RUN git clone https://github.com/scalaplatform/warm-sbt && cd warm-sbt && git checkout v0.3.0 && $UNDERLYING_SBT "+run" -Dsbt.boot.properties=/sbt.boot && cd .. && rm -rf warm-sbt
RUN mv /root/.sbt/* /drone/.sbt
RUN rm -rf /root/.sbt
# Save some space
RUN rm -rf /tmp/*
RUN mv /root/.coursier/* /drone/.coursier
RUN rm -rf /root/.coursier