-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
79 lines (74 loc) · 2.91 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
FROM openjdk:8-jdk-alpine
CMD ["groovysh"]
ENV GROOVY_HOME /opt/groovy
ENV GROOVY_VERSION 2.5.6
RUN set -o errexit -o nounset \
&& echo "Installing build dependencies" \
&& apk add --no-cache --virtual .build-deps \
gnupg \
\
&& echo "Downloading Groovy" \
&& wget -qO groovy.zip "https://dist.apache.org/repos/dist/release/groovy/${GROOVY_VERSION}/distribution/apache-groovy-binary-${GROOVY_VERSION}.zip" \
\
&& echo "Importing keys listed in http://www.apache.org/dist/groovy/KEYS from key server" \
&& export GNUPGHOME="$(mktemp -d)"; \
for key in \
"7FAA0F2206DE228F0DB01AD741321490758AAD6F" \
"331224E1D7BE883D16E8A685825C06C827AF6B66" \
"34441E504A937F43EB0DAEF96A65176A0FB1CD0B" \
"9A810E3B766E089FFB27C70F11B595CEDC4AEBB5" \
"81CABC23EECA0790E8989B361FF96E10F0E13706" \
; do \
for server in \
"ha.pool.sks-keyservers.net" \
"hkp://p80.pool.sks-keyservers.net:80" \
"pgp.mit.edu" \
; do \
echo " Trying ${server}"; \
if gpg --batch --no-tty --keyserver "${server}" --recv-keys "${key}"; then \
break; \
fi; \
done; \
done; \
if [ $(gpg --batch --no-tty --list-keys | grep -c "pub ") -ne 5 ]; then \
echo "ERROR: Failed to fetch GPG keys" >&2; \
exit 1; \
fi \
\
&& echo "Checking download signature" \
&& wget -qO groovy.zip.asc "https://dist.apache.org/repos/dist/release/groovy/${GROOVY_VERSION}/distribution/apache-groovy-binary-${GROOVY_VERSION}.zip.asc" \
&& gpg --batch --no-tty --verify groovy.zip.asc groovy.zip \
&& rm -rf "${GNUPGHOME}" \
&& rm groovy.zip.asc \
\
&& echo "Installing Groovy" \
&& unzip groovy.zip \
&& rm groovy.zip \
&& mkdir -p /opt \
&& mv "groovy-${GROOVY_VERSION}" "${GROOVY_HOME}/" \
&& ln -s "${GROOVY_HOME}/bin/grape" /usr/bin/grape \
&& ln -s "${GROOVY_HOME}/bin/groovy" /usr/bin/groovy \
&& ln -s "${GROOVY_HOME}/bin/groovyc" /usr/bin/groovyc \
&& ln -s "${GROOVY_HOME}/bin/groovyConsole" /usr/bin/groovyConsole \
&& ln -s "${GROOVY_HOME}/bin/groovydoc" /usr/bin/groovydoc \
&& ln -s "${GROOVY_HOME}/bin/groovysh" /usr/bin/groovysh \
&& ln -s "${GROOVY_HOME}/bin/java2groovy" /usr/bin/java2groovy \
\
&& echo "Cleaning up build dependencies" \
&& apk del .build-deps \
\
&& echo "Adding groovy user and group" \
&& addgroup -S -g 1000 groovy \
&& adduser -D -S -G groovy -u 1000 -s /bin/ash groovy \
&& mkdir -p /home/groovy/.groovy/grapes \
&& chown -R groovy:groovy /home/groovy \
\
&& echo "Symlinking root .groovy to groovy .groovy" \
&& ln -s /home/groovy/.groovy /root/.groovy
# Create Grapes volume
USER groovy
VOLUME "/home/groovy/.groovy/grapes"
WORKDIR /home/groovy
RUN set -o errexit -o nounset \
&& echo "Testing Groovy installation" \
&& groovy --version