-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (49 loc) · 2.38 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
# syntax=docker/dockerfile:1
ARG BUILD_IMAGE=gradle:7.4-jdk17
ARG RUN_IMAGE=quay.io/wildfly/wildfly:26.1.3.Final-jdk17
ARG ORACLE_DRIVER_PATH=/ojdbc11-21.7.0.0.jar
ARG MARIADB_DRIVER_PATH=/mariadb-java-client-3.3.3.jar
ARG CUSTOM_CRT_URL="https://ace.jlab.org/acc-ca.crt http://pki.jlab.org/JLabCA.crt"
################## Stage 0
FROM ${BUILD_IMAGE} as builder
ARG CUSTOM_CRT_URL
USER root
WORKDIR /
COPY . /app
RUN /app/scripts/update-certs-builder.sh ${CUSTOM_CRT_URL}
RUN cd /tmp \
##&& apk add openssl \
&& openssl genrsa -out localhost.key 2048 \
&& openssl req -key localhost.key -new -out localhost.csr -subj "/C=US/ST=Virginia/O=localhost dev/OU=IT Department/CN=localhost" \
&& openssl x509 -signkey localhost.key -in localhost.csr -req -days 99999 -out localhost.crt \
&& openssl pkcs12 -export -in localhost.crt -inkey localhost.key -name localhost -password pass:changeit > localhost.p12 \
&& keytool -importkeystore -srckeystore localhost.p12 -destkeystore server.p12 -srcstoretype pkcs12 -alias localhost -deststorepass changeit -srcstorepass changeit
## Let's minimize layers in final-product by organizing files into a single copy structure
RUN mkdir /unicopy \
&& cp /app/config/docker-server.env /unicopy \
&& cp /app/scripts/TestOracleConnection.java /unicopy \
&& cp /app/scripts/TestMariadbConnection.java /unicopy \
&& cp /app/scripts/container-entrypoint.sh /unicopy \
&& cp /app/scripts/container-healthcheck.sh /unicopy \
&& cp /app/scripts/server-setup.sh /unicopy \
&& cp /app/scripts/provided-setup.sh /unicopy \
&& cp /app/scripts/app-setup.sh /unicopy \
&& cp /app/scripts/update-certs-runner.sh /unicopy
################## Stage 1
FROM ${RUN_IMAGE} as runner
ARG CUSTOM_CRT_URL
ARG RUN_USER=jboss:jboss
ARG ORACLE_DRIVER_PATH
ARG MARIADB_DRIVER_PATH
USER root
COPY --from=builder /unicopy /
COPY --from=builder /tmp/server.p12 /opt/jboss/wildfly/standalone/configuration
RUN /update-certs-runner.sh ${CUSTOM_CRT_URL} \
&& chsh -s /bin/bash jboss \
&& /server-setup.sh /docker-server.env \
&& rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history
ENTRYPOINT ["/container-entrypoint.sh"]
ENV ORACLE_DRIVER_PATH=$ORACLE_DRIVER_PATH
ENV MARIADB_DRIVER_PATH=$MARIADB_DRIVER_PATH
USER ${RUN_USER}
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --start-interval=5s --retries=5 CMD /container-healthcheck.sh