-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathDockerfile
187 lines (163 loc) · 7.3 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright 2016 The University of Münster eLectures Team All rights reserved.
#
# Licensed under the Educational Community License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://opensource.org/licenses/ECL-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM --platform=${BUILDPLATFORM} docker.io/library/alpine:edge AS build-ffmpeg
ARG TARGETARCH
ARG FFMPEG_VERSION="release"
RUN apk add --no-cache \
curl \
tar \
xz \
&& mkdir -p /tmp/ffmpeg \
&& cd /tmp/ffmpeg \
&& curl -sSL "https://s3.opencast.org/opencast-ffmpeg-static/ffmpeg-${FFMPEG_VERSION}-${TARGETARCH}-static.tar.xz" \
| tar xJf - --strip-components 1 --wildcards '*/ffmpeg' '*/ffprobe' \
&& chown root:root ff* \
&& mv ff* /usr/local/bin
FROM docker.io/library/eclipse-temurin:17-jdk AS build-whisper-cpp
ARG WHISPER_CPP_VERSION="master"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
g++ \
gcc \
git \
libc-dev \
make
RUN mkdir -p /tmp/whisper.cpp
WORKDIR /tmp/whisper.cpp
RUN git clone https://github.com/ggerganov/whisper.cpp.git . \
&& git checkout "$WHISPER_CPP_VERSION"
RUN make -j \
&& sed -i 's#models_path=.*$#models_path=/usr/share/whisper.cpp/models/#' models/download-ggml-model.sh
RUN mkdir -p out \
&& mv main out/whisper.cpp \
&& mv quantize out/whisper.cpp-quantize \
&& mv server out/whisper.cpp-server \
&& mv models/download-ggml-model.sh out/whisper.cpp-model-download
FROM --platform=${BUILDPLATFORM} docker.io/library/eclipse-temurin:17-jdk AS build-opencast
ARG OPENCAST_REPO="https://github.com/opencast/opencast.git"
ARG OPENCAST_VERSION="develop"
ENV OPENCAST_SRC="/usr/src/opencast" \
OPENCAST_HOME="/opencast" \
OPENCAST_UHOME="/home/opencast" \
OPENCAST_UID="800" \
OPENCAST_GID="800" \
OPENCAST_USER="opencast" \
OPENCAST_GROUP="opencast"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
git \
gzip \
tar
RUN groupadd --system -g "${OPENCAST_GID}" "${OPENCAST_GROUP}" \
&& useradd --system -M -N -g "${OPENCAST_GROUP}" -d "${OPENCAST_UHOME}" -u "${OPENCAST_UID}" "${OPENCAST_USER}" \
&& mkdir -p "${OPENCAST_SRC}" "${OPENCAST_HOME}" "${OPENCAST_UHOME}" \
&& chown -R "${OPENCAST_USER}:${OPENCAST_GROUP}" "${OPENCAST_SRC}" "${OPENCAST_HOME}" "${OPENCAST_UHOME}"
USER "${OPENCAST_USER}"
WORKDIR "${OPENCAST_SRC}"
RUN git clone --recursive "${OPENCAST_REPO}" . \
&& git checkout "${OPENCAST_VERSION}" \
&& sed -i "s#https://mvn.opencast.org/#https://radosgw.public.os.wwu.de/mvn.opencast.org/#" pom.xml
RUN ./mvnw --batch-mode install \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-DskipTests=true \
-Dcheckstyle.skip=true \
-DskipJasmineTests=true
ARG OPENCAST_DISTRIBUTION
RUN tar -xzf build/opencast-dist-${OPENCAST_DISTRIBUTION}-*.tar.gz --strip 1 -C "${OPENCAST_HOME}"
FROM docker.io/library/eclipse-temurin:17-jdk
LABEL org.opencontainers.image.base.name="docker.io/library/eclipse-temurin:17-jdk"
ENV OPENCAST_HOME="/opencast" \
OPENCAST_DATA="/data" \
OPENCAST_CUSTOM_CONFIG="/etc/opencast" \
OPENCAST_USER="opencast" \
OPENCAST_GROUP="opencast" \
OPENCAST_UHOME="/home/opencast" \
OPENCAST_UID="800" \
OPENCAST_GID="800" \
WHISPER_CPP_MODELS="/usr/share/whisper.cpp/models"
ENV OPENCAST_CONFIG="${OPENCAST_HOME}/etc" \
OPENCAST_SCRIPTS="${OPENCAST_HOME}/docker/scripts" \
OPENCAST_STAGE_BASE_HOME="${OPENCAST_HOME}/docker/stage/base" \
OPENCAST_STAGE_OUT_HOME="${OPENCAST_HOME}/docker/stage/out"
RUN groupadd --system -g "${OPENCAST_GID}" "${OPENCAST_GROUP}" \
&& useradd --system -M -N -g "${OPENCAST_GROUP}" -d "${OPENCAST_UHOME}" -u "${OPENCAST_UID}" "${OPENCAST_USER}" \
&& mkdir -p "${OPENCAST_DATA}" "${OPENCAST_UHOME}" "${WHISPER_CPP_MODELS}" \
&& chown -R "${OPENCAST_USER}:${OPENCAST_GROUP}" "${OPENCAST_DATA}" "${OPENCAST_UHOME}" "${WHISPER_CPP_MODELS}"
# libgomp1 is a dependency of whisper.cpp. It is also installed as a dependency of Tesseract, but we want it to be an
# explicitly installed package.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
fontconfig \
fonts-dejavu \
fonts-freefont-ttf \
fonts-liberation \
fonts-linuxlibertine \
gosu \
inotify-tools \
jq \
libgomp1 \
netcat-openbsd \
openssl \
rsync \
tesseract-ocr \
tesseract-ocr-eng \
tzdata \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build-ffmpeg /usr/local/bin/ff* /usr/local/bin/
COPY --from=build-whisper-cpp /tmp/whisper.cpp/out/* /usr/local/bin/
COPY --from=build-opencast "${OPENCAST_HOME}" "${OPENCAST_HOME}"
COPY rootfs /
ARG OPENCAST_REPO="https://github.com/opencast/opencast.git"
ARG OPENCAST_VERSION="develop"
ARG OPENCAST_DISTRIBUTION
ARG VERSION=unkown
ARG BUILD_DATE=unkown
ARG GIT_COMMIT=unkown
ENV OPENCAST_REPO=${OPENCAST_REPO} \
OPENCAST_VERSION=${OPENCAST_VERSION} \
OPENCAST_DISTRIBUTION=${OPENCAST_DISTRIBUTION}
RUN if [ "${OPENCAST_DISTRIBUTION}" = "allinone" ]; then \
rm -f "${OPENCAST_CONFIG}/org.opencastproject.organization-mh_default_org.cfg-clustered"; \
fi \
&& mv "${OPENCAST_CONFIG}/org.opencastproject.organization-mh_default_org.cfg-clustered" "${OPENCAST_CONFIG}/org.opencastproject.organization-mh_default_org.cfg" || true \
&& chown "${OPENCAST_USER}:${OPENCAST_GROUP}" "${OPENCAST_HOME}" "${OPENCAST_CONFIG}" \
&& chown -R "${OPENCAST_USER}:${OPENCAST_GROUP}" "${OPENCAST_HOME}/data" \
\
&& mkdir -p "${OPENCAST_STAGE_BASE_HOME}" \
&& rsync -vrlog --chown=0:0 "${OPENCAST_CONFIG}" "${OPENCAST_STAGE_BASE_HOME}" \
\
&& javac "${OPENCAST_SCRIPTS}/TryToConnectToDb.java" \
&& rm -rf /tmp/* "${OPENCAST_SCRIPTS}/TryToConnectToDb.java"
WORKDIR "${OPENCAST_HOME}"
EXPOSE 8080
VOLUME [ "${OPENCAST_DATA}" ]
LABEL maintainer="University of Münster eLectures Team <[email protected]>" \
org.opencontainers.image.title="opencast-${OPENCAST_DISTRIBUTION}" \
org.opencontainers.image.description="container image for the Opencast ${OPENCAST_DISTRIBUTION} distribution" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.vendor="Opencast" \
org.opencontainers.image.authors="University of Münster eLectures Team <[email protected]>" \
org.opencontainers.image.licenses="ECL-2.0" \
org.opencontainers.image.url="https://github.com/opencast/opencast-docker/blob/${VERSION}/README.md" \
org.opencontainers.image.documentation="https://github.com/opencast/opencast-docker/blob/${VERSION}/README.md" \
org.opencontainers.image.source="https://github.com/opencast/opencast-docker" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${GIT_COMMIT}"
HEALTHCHECK --timeout=10s CMD /docker-healthcheck.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["app:start"]