-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
75 lines (58 loc) · 3.19 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
# Keep in sync with version in frank-runner.properties. Detailed instructions can be found in CONTRIBUTING.md.
# Check whether java-orig files have changed in F!F and update custom code (java and java-orig files) accordingly
ARG FF_VERSION=7.9-20231026.224138
ARG GID=1000
ARG UID=1000
FROM tomcat:8-jre11-temurin-jammy AS base
ARG FF_VERSION
ARG GID
ARG UID
# Secure files (CIS-DI-0008)
RUN chmod -R 751 /usr/bin /usr/sbin
# Create folder and user, and set file permissions
RUN set -eux && \
# Create default directory for configurations, properties and credential filesystem
mkdir -p /opt/frank/secrets && \
# Create tomcat user for stepping down from root
groupadd -g ${GID} tomcat && \
useradd -u ${UID} -g tomcat -s /usr/sbin/nologin -l tomcat && \
# Change permissions and ownership of files
chown -hR tomcat:tomcat ${CATALINA_HOME} && \
chown -hR tomcat:tomcat /opt/frank
# All previous actions are performed as root. Run following instructions and start container as tomcat.
USER tomcat
# Needed to created a valid "from" image when using ARG variable
# COPY "--from=docker.io/frankframework/frankframework:${FF_VERSION}" doesn't work
FROM docker.io/frankframework/frankframework:${FF_VERSION} AS ff-builder
FROM base AS ff-base
# Copy environment configuration
COPY --from=ff-builder --chown=tomcat /usr/local/tomcat/conf/catalina.properties /usr/local/tomcat/conf/catalina.properties
COPY --from=ff-builder --chown=tomcat /usr/local/tomcat/lib/ /usr/local/tomcat/lib/
COPY --from=ff-builder --chown=tomcat /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT
# TempFix TODO: Move this to the credentialprovider.properties
ENV credentialFactory.class=nl.nn.credentialprovider.PropertyFileCredentialFactory
ENV credentialFactory.map.properties=/opt/frank/resources/credentials.properties
ENV zaakbrug.zds.timezone=UTC
# Copy dependencies
COPY --chown=tomcat lib/server/ /usr/local/tomcat/lib/
COPY --chown=tomcat lib/webapp/ /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/
# When deploying the "context.xml" should be copied to /usr/local/tomcat/conf/Catalina/localhost/ROOT.xml
COPY --chown=tomcat src/main/webapp/META-INF/context.xml /usr/local/tomcat/conf/Catalina/localhost/ROOT.xml
# Copy Frank!
COPY --chown=tomcat src/main/configurations/ /opt/frank/configurations/
COPY --chown=tomcat src/main/resources/ /opt/frank/resources/
COPY --chown=tomcat src/test/testtool/ /opt/frank/testtool/
# Compile custom class
FROM eclipse-temurin:8-jdk-jammy AS custom-code-builder
COPY --from=ff-base /usr/local/tomcat/lib/ /usr/local/tomcat/lib/
COPY --from=ff-base /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT
COPY src/main/java /tmp/java
RUN mkdir /tmp/classes \
&& javac \
/tmp/java/nl/nn/adapterframework/parameters/Parameter.java \
-classpath "/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/*:/usr/local/tomcat/lib/*" \
-verbose -d /tmp/classes
FROM ff-base AS final
COPY --from=custom-code-builder --chown=tomcat /tmp/classes/ /usr/local/tomcat/webapps/ROOT/WEB-INF/classes
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=60 \
CMD curl --fail --silent http://localhost:8080/iaf/api/server/health || (curl --silent http://localhost:8080/iaf/api/server/health && exit 1)