-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
173 lines (157 loc) · 5.36 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
# See https://github.com/jlesage/docker-baseimage-gui
ARG app_version="3.64.0"
# Bump if publishing a new image with the same app_version, reset to 1 with new app versions
ARG image_revision="1"
# BUILDPLATFORM and TARGETPLATFORM are defined when using BuildKit (i.e. docker buildx)
# Do NOT define a default value or it will override what BuildKit sets
# Do NOT declare TARGETPLATFORM as an ARG before FROM either or it becomes empty
#ARG TARGETPLATFORM
FROM jlesage/baseimage-gui:debian-12-v4 AS extract-stage
ARG TARGETPLATFORM
ARG app_version
ARG download_url_template="https://github.com/mifi/lossless-cut/releases/download/v${app_version}/LosslessCut-linux-#ARCH#.tar.bz2"
#ARG download_url_template="https://github.com/mifi/lossless-cut/releases/latest/download/LosslessCut-linux-#ARCH#.tar.bz2"
# Fail early if TARGETPLATFORM isn't set
RUN test -n "${TARGETPLATFORM}"
# Note ADDing a local tarball automatically extracts it whereas a tarball url is downloaded AS-IS
#ADD ${download_url} /
# The LC_ALL is an attempt to prevent apt complaining about the locale
# Deduce LosslessCut architecture suffix based on TARGETPLATFORM
RUN LC_ALL=C add-pkg \
ca-certificates \
pbzip2 \
wget \
&& { \
[ $TARGETPLATFORM = linux/amd64 ] && echo x64 ; \
[ $TARGETPLATFORM = linux/arm64 ] && echo arm64 ; \
[ $TARGETPLATFORM = linux/arm/v7 ] && echo armv7l ; \
} \
| xargs -I '#ARCH#' \
wget --progress=dot:giga -O /app.tbz ${download_url_template} \
&& tar -C / -I pbzip2 -xvf /app.tbz \
&& mv /LosslessCut-linux-*/ /LosslessCut
FROM jlesage/baseimage-gui:debian-12-v4 AS final-stage
ARG app_icon="https://raw.githubusercontent.com/mifi/lossless-cut/master/src/renderer/src/icon.svg"
ARG app_version
ARG image_revision
# Missing libraries as of v3.59.1, adjusted to Debian 11
# See the helper script 'generate_dependencies_list.bash'
RUN LC_ALL="C.UTF-8" add-pkg \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libatspi2.0-0 \
libavahi-client3 \
libavahi-common3 \
libblkid1 \
libbrotli1 \
libbsd0 \
libcairo2 \
libcairo-gobject2 \
libcups2 \
libdatrie1 \
libdrm2 \
libepoxy0 \
libffi8 \
libfontconfig1 \
libfreetype6 \
libfribidi0 \
libgbm1 \
libgcrypt20 \
libgdk-pixbuf-2.0-0 \
libglib2.0-0 \
libgmp10 \
libgnutls30 \
libgraphite2-3 \
libgssapi-krb5-2 \
libgtk-3-0 \
libharfbuzz0b \
libhogweed6 \
libidn2-0 \
libjpeg62-turbo \
libk5crypto3 \
libkrb5-3 \
libkrb5support0 \
liblz4-1 \
libmd0 \
libmount1 \
libnettle8 \
libnspr4 \
libnss3 \
libp11-kit0 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpangoft2-1.0-0 \
libpcre2-8-0 \
libpixman-1-0 \
libpng16-16 \
libpulse0 \
libsystemd0 \
libtasn1-6 \
libthai0 \
libunistring2 \
libuuid1 \
libwayland-client0 \
libwayland-cursor0 \
libwayland-egl1 \
libwayland-server0 \
libx11-6 \
libxau6 \
libxcb1 \
libxcb-randr0 \
libxcb-render0 \
libxcb-shm0 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxdmcp6 \
libxext6 \
libxfixes3 \
libxi6 \
libxinerama1 \
libxkbcommon0 \
libxrandr2 \
libxrender1 \
libzstd1
# some manual additions, mostly from v3.47.1
RUN LC_ALL="C.UTF-8" add-pkg \
libgl1 \
libx11-xcb1
# #libxss1 \
# #libxtst6
COPY --from=extract-stage /LosslessCut /LosslessCut
# Workaround for LosslessCut on arm not containing ffmpeg
RUN test -x /LosslessCut/resources/ffmpeg \
|| ( LC_ALL=C add-pkg ffmpeg \
&& ln -s /usr/bin/ffmpeg /usr/bin/ffprobe /LosslessCut/resources/ \
)
# Sandboxing doesn't appear to work, Docker should be sandboxed enough though
RUN echo '#!/bin/sh' > /startapp.sh \
&& echo 'exec /LosslessCut/losslesscut' --no-sandbox >> /startapp.sh \
&& chmod 0755 /startapp.sh
#&& chmod 04755 /LosslessCut-linux-${app_platform}/chrome-sandbox
# Set app name, version and generate favicons
RUN set-cont-env APP_NAME "LosslessCut" \
&& set-cont-env APP_VERSION ${app_version} \
&& set-cont-env DOCKER_IMAGE_VERSION ${image_revision} \
&& APP_ICON_URL=$app_icon && \
install_app_icon.sh "$APP_ICON_URL"
VOLUME ["/config", "/storage"]
# 5800: Web, 5900: VNC
EXPOSE 5800/tcp 5900/tcp
# Note the org.label-schema.* labels are inherited from the base image
# TODO: Find out if it's worth overwriting them
LABEL \
maintainer="Toni Corvera <[email protected]>" \
org.opencontainers.image.title="Dockerized LosslessCut" \
org.opencontainers.image.description="Docker container to make LosslessCut usable via web browser and VNC" \
org.opencontainers.image.version="${image_revision}}" \
org.opencontainers.image.url="https://hub.docker.com/repository/docker/outlyernet/losslesscut" \
org.opencontainers.image.source="https://github.com/outlyer-net/docker-losslesscut" \
org.opencontainers.image.licenses="GPL-2.0"
# Define HOME to ease usage of the file chooser
ENV HOME=/storage
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD \
pidof cinit \
&& pidof losslesscut \
&& nc -z -v 127.0.0.1 $WEB_LISTENING_PORT