-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile-build
178 lines (162 loc) · 6.26 KB
/
Dockerfile-build
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
# 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 docker.io/library/eclipse-temurin:17-jdk
LABEL org.opencontainers.image.base.name="docker.io/maven:3-eclipse-temurin-17"
ARG OPENCAST_REPO="https://github.com/opencast/opencast.git"
ARG OPENCAST_VERSION="develop"
ARG VERSION=unkown
ARG BUILD_DATE=unkown
ARG GIT_COMMIT=unkown
LABEL maintainer="University of Münster eLectures Team <[email protected]>" \
org.opencontainers.image.title="opencast-build" \
org.opencontainers.image.description="container image that provides an Opencast build and development environment" \
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}"
ENV OPENCAST_REPO="${OPENCAST_REPO}" \
OPENCAST_VERSION="${OPENCAST_VERSION}" \
OPENCAST_DISTRIBUTION="${OPENCAST_DISTRIBUTION}" \
OPENCAST_SRC="/usr/src/opencast" \
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" \
OPENCAST_BUILD_ASSETS="/docker" \
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"
ENV ORG_OPENCASTPROJECT_SECURITY_ADMIN_USER="admin" \
ORG_OPENCASTPROJECT_SECURITY_ADMIN_PASS="opencast" \
ORG_OPENCASTPROJECT_SECURITY_DIGEST_USER="opencast_system_account" \
ORG_OPENCASTPROJECT_SECURITY_DIGEST_PASS="CHANGE_ME"
# Install Firefox from PPA
COPY <<EOF /etc/apt/preferences.d/mozillateam
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 100
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1
EOF
# 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 \
gnupg \
software-properties-common \
&& add-apt-repository -y ppa:mozillateam/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
firefox \
g++ \
gcc \
git \
gzip \
libc-dev \
make \
openssl \
sudo \
tar \
xz-utils \
&& 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 \
\
&& sudo ln -s /usr/local/openjdk*/bin/* /usr/local/bin/ \
\
&& deluser "$(id -nu 1000)" \
&& rm -rf /home/ubuntu \
\
&& 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}" "${OPENCAST_DATA}" "${OPENCAST_BUILD_ASSETS}" "${WHISPER_CPP_MODELS}" \
&& chown -R "${OPENCAST_USER}:${OPENCAST_GROUP}" "${OPENCAST_HOME}" "${OPENCAST_UHOME}" "${OPENCAST_DATA}" "${WHISPER_CPP_MODELS}" \
&& echo "opencast-builder ALL = NOPASSWD: ALL" > /etc/sudoers.d/opencast-builder \
\
&& cd / \
&& rm -rf /tmp/* /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 rootfs "${OPENCAST_BUILD_ASSETS}/"
COPY rootfs-build /
WORKDIR "${OPENCAST_SRC}"
EXPOSE 8080 5005
VOLUME [ "${OPENCAST_DATA}", "${OPENCAST_SRC}", "/root/.m2" ]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bash"]