-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
153 lines (118 loc) · 4.56 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
ARG BUILDER_TYPE=release
# Kitodo.Production Release Local
FROM alpine:latest AS kitodo-builder-local
RUN apk update
ARG BUILDER_LOCAL_WAR=build-resources/kitodo.war
ARG BUILDER_LOCAL_SQL=build-resources/kitodo.sql
ARG BUILDER_LOCAL_CONFIG_MODULES_ZIP=build-resources/kitodo-config-modules.zip
COPY ${BUILDER_LOCAL_WAR} /data/kitodo.war
COPY ${BUILDER_LOCAL_SQL} /data/kitodo.sql
COPY ${BUILDER_LOCAL_CONFIG_MODULES_ZIP} /data/kitodo-config-modules.zip
# Kitodo.Production Release Builder
FROM alpine:latest AS kitodo-builder-release
RUN apk update && \
apk --no-cache add curl
ARG BUILDER_RELEASE_VERSION=3.5.0
ARG BUILDER_RELEASE_WAR=kitodo-3.5.0.war
ARG BUILDER_RELEASE_SQL=kitodo_3-5-0.sql
ARG BUILDER_RELEASE_CONFIG_MODULES_ZIP=kitodo_3-5-0_config_modules.zip
COPY build-release.sh build.sh
RUN mkdir /data/ && \
chmod +x /build.sh && \
sh build.sh
# Kitodo.Production Git Builder
FROM maven:3.8.6-openjdk-11-slim AS kitodo-builder-git
RUN apt-get update && \
apt-get install -y \
zip \
unzip \
mariadb-server \
wget
ARG BUILDER_GIT_REF=master
ARG BUILDER_GIT_REPOSITORY=kitodo/kitodo-production
ARG BUILDER_GIT_SERVER_URL=https://github.com
ARG BUILDER_GIT_SOURCE_URL=${BUILDER_GIT_SERVER_URL}/${BUILDER_GIT_REPOSITORY}/
ENV JAVA_OPTS="-Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Xmx2048m -Xms1024m -XX:MaxPermSize=512m"
ENV MAVEN_OPTS="-Xms256m -Xmx512m"
COPY wait-for-it.sh /wait-for-it.sh
COPY build-git.sh /build.sh
RUN mkdir /data/ && \
chmod +x /build.sh && \
chmod +x /wait-for-it.sh && \
sh build.sh
# Kitodo Builder - alias for builder type cause COPY --from does not allow build arguments
FROM kitodo-builder-${BUILDER_TYPE} AS kitodo-builder
# Kitodo.Production
FROM tomcat:9.0.65-jre11-openjdk-slim AS kitodo
ARG GIT_REF=master
ARG GIT_REPOSITORY=kitodo/kitodo-production
ARG GIT_SERVER_URL=https://github.com
ARG BUILD_DATE
LABEL \
maintainer="https://slub-dresden.de" \
org.label-schema.vendor="Saxon State and University Library Dresden" \
org.label-schema.name="Kitodo.Production" \
org.label-schema.vcs-ref=$GIT_REF \
org.label-schema.vcs-url="${GIT_SERVER_URL}/${GIT_REPOSITORY}/" \
org.label-schema.build-date=$BUILD_DATE \
org.opencontainers.image.vendor="Saxon State and University Library Dresden" \
org.opencontainers.image.title="Kitodo.Production" \
org.opencontainers.image.description="Kitodo.Production is the workflow management module in the Kitodo suite." \
org.opencontainers.image.source="${GIT_SERVER_URL}/${GIT_REPOSITORY}/" \
org.opencontainers.image.documentation="${GIT_SERVER_URL}/${GIT_REPOSITORY}/blob/${GIT_REF}/README.md" \
org.opencontainers.image.revision=$GIT_REF \
org.opencontainers.image.created=$BUILD_DATE
ENV JAVA_OPTS="-Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Xmx2048m -Xms1024m -XX:MaxPermSize=512m"
ENV JPDA=false
ENV JPDA_ADDRESS=*:5005
ENV APP_FOOTER_INFO=""
ENV DB_HOST=localhost
ENV DB_PORT=3306
ENV DB_NAME=kitodo
ENV DB_USER=kitodo
ENV DB_PASSWORD=kitodo
ENV ES_HOST=localhost
ENV MQ_HOST=localhost
ENV MQ_PORT=61616
# make apt run non-interactive during build
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y \
apt-utils \
net-tools \
nano \
unzip \
procps \
dnsutils \
mariadb-client \
openssh-client \
imagemagick \
rsyslog \
--no-install-recommends
# copy build resources of kitodo-builder stage
COPY --from=kitodo-builder /data /tmp/kitodo
COPY tomcat.conf /etc/rsyslog.d/
COPY startup.sh /usr/bin/
COPY deploy.sh /usr/bin/
COPY wait-for-it.sh /wait-for-it.sh
# system configs
RUN mkdir /.ssh && \
cat > /etc/ssh/ssh_known_hosts && \
cat > /usr/bin/before_startup.sh && \
chmod +x /usr/bin/before_startup.sh && \
chmod +x /usr/bin/startup.sh && \
chmod +x /usr/bin/deploy.sh && \
chmod +x /wait-for-it.sh
# application configs
RUN unzip /tmp/kitodo/kitodo-config-modules.zip -x *.bat -d /tmp/kitodo/kitodo-config-modules-unzipped && \
chmod -R go+w /tmp/kitodo/kitodo-config-modules-unzipped && \
mkdir -p /tmp/kitodo/kitodo-config-modules /tmp/kitodo/overwrites/data /tmp/kitodo/overwrites/config /tmp/kitodo/overwrites/sql && \
touch /tmp/kitodo/overwrites/sql/post_init.sql && \
mv /tmp/kitodo/kitodo-config-modules-unzipped/*/* /tmp/kitodo/kitodo-config-modules/ && \
chmod 544 /tmp/kitodo/kitodo-config-modules/scripts/*.sh && \
rm /tmp/kitodo/kitodo-config-modules.zip && \
rm -fr /tmp/kitodo/kitodo-config-modules-unzipped
CMD ["/bin/bash", "-c", "/usr/bin/before_startup.sh && /usr/bin/startup.sh"]
EXPOSE 8080
# make apt run interactive during logins
ENV DEBIAN_FRONTEND teletype