-
Notifications
You must be signed in to change notification settings - Fork 18
/
baseDockerfile-slim
99 lines (94 loc) · 3.14 KB
/
baseDockerfile-slim
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
94
95
96
97
98
99
FROM IMAGE:TAG
ENV JETTY_VERSION VERSION
ENV JETTY_HOME /usr/local/jetty
ENV JETTY_BASE /var/lib/jetty
ENV TMPDIR /tmp/jetty
ENV PATH $JETTY_HOME/bin:$PATH
ENV JETTY_TGZ_URL https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/$JETTY_VERSION/jetty-home-$JETTY_VERSION.tar.gz
# GPG Keys are personal keys of Jetty committers (see https://github.com/eclipse/jetty.project/blob/0607c0e66e44b9c12a62b85551da3a0edce0281e/KEYS.txt)
ENV JETTY_GPG_KEYS \
# Jan Bartel <[email protected]>
AED5EE6C45D0FE8D5D1B164F27DED4BF6216DB8F \
# Jesse McConnell <[email protected]>
2A684B57436A81FA8706B53C61C3351A438A3B7D \
# Joakim Erdfelt <[email protected]>
5989BAF76217B843D66BE55B2D0E1FB8FE4B68B4 \
# Joakim Erdfelt <[email protected]>
B59B67FD7904984367F931800818D9D68FB67BAC \
# Joakim Erdfelt <[email protected]>
BFBB21C246D7776836287A48A04E0C74ABB35FEA \
# Simone Bordet <[email protected]>
8B096546B1A8F02656B15D3B1677D141BCF3584D \
# Olivier Lamy <[email protected]>
F254B35617DC255D9344BCFA873A8E86B4372146 \
# Ludovic Orban <[email protected]>
E22488CC94F63E3FC928536C4241C08270D999C3
RUN set -xe ; \
# Save initial installation state
export savedAptMark="$(apt-mark showmanual)" ; \
#
mkdir -p $TMPDIR ; \
#
# Install utils needed to verify keys
apt-get update ; \
apt-get install -y --no-install-recommends \
ca-certificates \
p11-kit \
gnupg2 \
curl \
; \
#
# fetch GPG keys
export GNUPGHOME=/jetty-keys ; \
mkdir -p "$GNUPGHOME" ; \
for key in $JETTY_GPG_KEYS; do \
gpg --batch --keyserver "hkps://keyserver.ubuntu.com" --recv-keys "$key"; \
done ; \
#
# Fetch jetty release into JETTY_HOME
mkdir -p "$JETTY_HOME" ; \
cd $JETTY_HOME ; \
curl -SL "$JETTY_TGZ_URL" -o jetty.tar.gz ; \
curl -SL "$JETTY_TGZ_URL.asc" -o jetty.tar.gz.asc ; \
#
# Verify GPG signatures
gpg --batch --verify jetty.tar.gz.asc jetty.tar.gz ; \
#
# Unpack jetty
tar -xvf jetty.tar.gz --strip-components=1 ; \
sed -i '/jetty-logging/d' etc/jetty.conf ; \
#
# Create and configure the JETTY_HOME directory
mkdir -p "$JETTY_BASE" ; \
cd $JETTY_BASE ; \
case "$JETTY_VERSION" in \
"12."*) START_MODULES="server,http,ext,resources" ;; \
*) START_MODULES="server,http,deploy,ext,resources,jsp,jstl,websocket" ;; \
esac ; \
java -jar "$JETTY_HOME/start.jar" --create-startd \
--add-to-start="$START_MODULES" ; \
groupadd -r jetty && useradd -r -g jetty jetty ; \
chown -R jetty:jetty "$JETTY_HOME" "$JETTY_BASE" "$TMPDIR" ; \
usermod -d $JETTY_BASE jetty ; \
gpgconf --kill all ; \
#
# Cleanup any apt
apt-mark auto '.*' > /dev/null ; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null ; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ; \
rm -rf /var/lib/apt/lists/* ; \
#
# Cleanup
rm -rf /tmp/hsperfdata_root ; \
rm -fr $JETTY_HOME/jetty.tar.gz* ; \
rm -fr /jetty-keys $GNUPGHOME ; \
rm -rf /tmp/hsperfdata_root ; \
#
# Basic smoke test
java -jar "$JETTY_HOME/start.jar" --list-config ;
WORKDIR $JETTY_BASE
COPY docker-entrypoint.sh generate-jetty-start.sh /
USER jetty
EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["java","-jar","/usr/local/jetty/start.jar"]