-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
93 lines (78 loc) · 3.88 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
FROM openjdk:8-alpine
MAINTAINER David Garcia <[email protected]>
#LABELS
LABEL org.label-schema.build-date="2017-04-07T08:20:50.52Z"
LABEL org.label-schema.usage="/usr/doc/app-usage.txt"
LABEL org.label-schema.vcs-url="https://github.com/own3dh2so4/docker-sbt-compiler"
LABEL org.label-schema.vendor="own3dh2so4"
LABEL org.label-schema.docker.cmd="docker run -it --rm -v \"$PWD:/app\" -v \"$HOME/.ivy2:/root/.ivy2\" sbt-builder sbt {sbtOption}"
# Scala related variables
ARG SCALA_VERSION=2.11.7
ARG SCALA_BINARY_ARCHIVE_NAME=scala-${SCALA_VERSION}
ARG SCALA_BINARY_DOWNLOAD_URL=http://downloads.lightbend.com/scala/${SCALA_VERSION}/${SCALA_BINARY_ARCHIVE_NAME}.tgz
# SBT related variables
ARG SBT_VERSION=0.13.8
ARG SBT_BINARY_ARCHIVE_NAME=sbt-$SBT_VERSION
ARG SBT_BINARY_DOWNLOAD_URL=http://dl.bintray.com/sbt/native-packages/sbt/$SBT_VERSION/sbt-$SBT_VERSION.tgz
# Configure env variables for Scala, SBT and add to PATH.
ENV SCALA_HOME /usr/local/${SCALA_BINARY_ARCHIVE_NAME}
ENV SBT_HOME /usr/local/sbt
ENV PATH ${PATH}:${SCALA_HOME}/bin:${SBT_HOME}/bin
# VARIABLES TO INSTALL GNU libc (aka glibc)
ENV ALPINE_GLIBC_BASE_URL https://github.com/sgerrand/alpine-pkg-glibc/releases/download
ENV ALPINE_GLIBC_PACKAGE_VERSION 2.25-r0
ENV ALPINE_GLIBC_BASE_PACKAGE_FILENAME glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk
ENV ALPINE_GLIBC_BIN_PACKAGE_FILENAME glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk
ENV ALPINE_GLIBC_I18N_PACKAGE_FILENAME glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk
ENV LANG=C.UTF-8
ADD app-usage.txt /usr/doc/app-usage.txt
# Install GLIBC
RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
ALPINE_GLIBC_PACKAGE_VERSION="2.25-r0" && \
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \
wget \
"https://raw.githubusercontent.com/andyshinn/alpine-pkg-glibc/master/sgerrand.rsa.pub" \
-O "/etc/apk/keys/sgerrand.rsa.pub" && \
wget \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
apk add --no-cache \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
\
rm "/etc/apk/keys/sgerrand.rsa.pub" && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \
echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \
\
apk del glibc-i18n && \
\
rm "/root/.wget-hsts" && \
apk del .build-dependencies && \
rm \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
ENV LANG=C.UTF-8
# Install basic packages
RUN apk add --update --no-cache bash fping glibc libcap openssl unzip && \
rm -rf /var/cache/apk/*
# Install Scala
## Piping curl directly in tar
RUN \
wget "${SCALA_BINARY_DOWNLOAD_URL}" && \
tar -xvzf scala-${SCALA_VERSION}.tgz && \
cp -a scala-${SCALA_VERSION}/* /usr/local && rm -rf scala-${SCALA_VERSION} && rm -rf scala-${SCALA_VERSION}.tgz && \
echo >> /root/.bashrc && \
echo -ne "- with scala $SCALA_VERSION\n" >> /root/.built
# Install sbt
RUN apk add --no-cache --update bash && \
wget "${SBT_BINARY_DOWNLOAD_URL}" && \
tar -xvzf sbt-${SBT_VERSION}.tgz && \
cp -a sbt/* /usr/local && rm -rf sbt && rm -rf sbt-${SBT_VERSION}.tgz && \
echo -ne "- with sbt $SBT_VERSION\n" >> /root/.built
WORKDIR /app