-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (36 loc) · 1.62 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (36 loc) · 1.62 KB
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
# Build layer
FROM mcr.microsoft.com/openjdk/jdk:21-mariner AS builder
ARG ANT_VERSION=1.10.17
ARG ANT_DOWNLOAD_SHA512=a96ca6455ec9af5e702df7d1ed5a2ec1cfb381eac3e9a767ecb6be1706e826941045e8fd7ca663ba101bc47bfa18351f540dd27e9e7af57908ac78e65268eee7
ARG ANT_MIRROR=https://archive.apache.org
RUN tdnf install -y tar
# Install Ant
RUN set -o errexit -o nounset \
&& echo "Downloading Ant" \
&& curl -fsL -o ant.tar.gz "${ANT_MIRROR}/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz" \
&& echo "Checking Ant download hash" \
&& echo "${ANT_DOWNLOAD_SHA512} ant.tar.gz" | sha512sum -c - \
&& echo "Extracting Ant" \
&& tar -zvxf ant.tar.gz -C /opt/ \
&& rm ant.tar.gz \
&& mv /opt/apache-ant-${ANT_VERSION} /opt/ant
ENV ANT_HOME=/opt/ant
ENV PATH=${PATH}:${ANT_HOME}/bin
RUN ant -version
# Build the application
COPY build.xml build.xml
COPY ./config config
COPY ./lib lib
COPY ./src src
# COPY ./web-customizations web-customizations
RUN ant package
# Runtime layer
FROM tomcat:9.0-jdk21
LABEL org.opencontainers.image.description="CMS Platform web application"
LABEL org.opencontainers.image.source="https://github.com/rajkowski/cms-platform"
LABEL org.opencontainers.image.licenses="Apache"
COPY --from=builder target/cms-platform.war /usr/local/tomcat/webapps/ROOT.war
ENV CATALINA_OPTS="-XX:InitialRAMPercentage=10 -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80 -XX:+ExitOnOutOfMemoryError"
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 CMD curl -I -f --max-time 5 --header "X-Monitor: healthcheck" http://localhost:8080/api/liveness || exit 1
CMD ["catalina.sh", "run"]