-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (44 loc) · 2.01 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
ARG BUILD_IMAGE=gradle:7.4-jdk17-alpine
ARG RUN_IMAGE=eclipse-temurin:11-alpine@sha256:87219038abbc0e3a14868694b3567a39a4a6779de66ab0a23ff2c3812a8f1181
ARG CUSTOM_CRT_URL=http://pki.jlab.org/JLabCA.crt
################## Stage 0
FROM ${BUILD_IMAGE} as builder
ARG CUSTOM_CRT_URL
USER root
WORKDIR /
RUN if [ -z "${CUSTOM_CRT_URL}" ] ; then echo "No custom cert needed"; else \
wget -O /usr/local/share/ca-certificates/customcert.crt $CUSTOM_CRT_URL \
&& update-ca-certificates \
&& keytool -import -alias custom -file /usr/local/share/ca-certificates/customcert.crt -cacerts -storepass changeit -noprompt \
&& export OPTIONAL_CERT_ARG=--cert=/etc/ssl/certs/ca-certificates.crt \
; fi
COPY . /app
RUN cd /app && gradle build -x test --no-watch-fs $OPTIONAL_CERT_ARG
################## Stage 1
FROM ${RUN_IMAGE} as runner
ARG CUSTOM_CRT_URL
ARG RUN_USER=guest
ARG APP_HOME=/opt/jaws-registrations2epics
USER root
COPY --from=builder /app/docker-entrypoint.sh /docker-entrypoint.sh
COPY --from=builder /app/build/install /opt
## Allow JLab intercepting proxy to intercept with it's legacy renegotiation and custom cert else onsite builds fail
RUN sed -i 's/providers = provider_sect/providers = provider_sect\n\
ssl_conf = ssl_sect\n\
\n\
[ssl_sect]\n\
system_default = system_default_sect\n\
\n\
[system_default_sect]\n\
Options = UnsafeLegacyRenegotiation/' /etc/ssl/openssl.cnf
RUN if [ -z "${CUSTOM_CRT_URL}" ] ; then echo "No custom cert needed"; else \
mkdir -p /usr/local/share/ca-certificates \
&& wget -O /usr/local/share/ca-certificates/customcert.crt $CUSTOM_CRT_URL \
&& cat /usr/local/share/ca-certificates/customcert.crt >> /etc/ssl/certs/ca-certificates.crt \
&& keytool -import -alias custom -file /usr/local/share/ca-certificates/customcert.crt -cacerts -storepass changeit -noprompt \
; fi \
&& apk add --no-cache --update curl libstdc++ \
&& chown -R ${RUN_USER}:0 ${APP_HOME} \
&& chmod -R g+rw ${APP_HOME}
USER ${RUN_USER}
ENTRYPOINT ["/docker-entrypoint.sh"]