forked from coppit/docker-filebot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
130 lines (96 loc) · 5.04 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
#FROM hurricane/dockergui:x11rdp
FROM scratch
#FROM hurricane/dockergui:xvnc
MAINTAINER David Coppit <[email protected]>
ENV APP_NAME="Filebot" WIDTH=1280 HEIGHT=720 TERM=xterm
# Use baseimage-docker's init system
CMD ["/sbin/my_init"]
ENV DEBIAN_FRONTEND noninteractive
ADD dpkg-excludes /etc/dpkg/dpkg.cfg.d/excludes
RUN true && \
# Create dir to keep things tidy. Make sure it's readable by $USER_ID
mkdir /files && \
chmod a+rwX /files && \
# Speed up APT
echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup && \
echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache && \
# Filebot requires Java 8. UI doesn't work with openjdk, so we use Oracle Java. (Gives an error when trying to rename a
# file.)
add-apt-repository ppa:webupd8team/java
RUN true && \
# Auto-accept Oracle JDK license
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
# Update apt and install dependencies.
apt-get update && \
# Fix from https://stackoverflow.com/a/48343372/730300. Download first, let it fail, patch, then try again
# See also: https://askubuntu.com/questions/998047/how-to-replace-a-faulty-java-installation-with-a-new-one
( apt-get install -qy 'oracle-java8-installer=8u201-1~webupd8~1' || true )
RUN true && \
#sed -i 's|JAVA_VERSION=8u201' /var/lib/dpkg/info/oracle-java8-installer.* && \
#sed -i 's|PARTNER_URL=https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz/' /var/lib/dpkg/info/oracle-java8-installer.* && \
#sed -i 's|SHA256SUM_TGZ="12c745fbb8735bf450b8c6ba6f649bebe19915f05742975e443bdc8566170352"' /var/lib/dpkg/info/oracle-java8-installer.* && \
#sed -i 's|J_DIR=jdk1.8.0_201' /var/lib/dpkg/info/oracle-java8-installer.* && \
# Install a specific version for reproducible builds. See this for supported versions:
# https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages
apt-get install -qy 'oracle-java8-installer=8u201-1~webupd8~1' && \
apt-get install -qy oracle-java8-set-default
RUN true && \
# libchromaprint-tools for fpcalc, used to compute AcoustID fingerprints for MP3s.
apt-get install -qy mediainfo libchromaprint-tools && \
# I'm not sure if these are actually needed, but they suppress some Java exceptions
apt-get install -qy libxslt1-dev libglapi-mesa-lts-xenial libgl1-mesa-glx-lts-xenial && \
# Install watchdog module for Python3, for monitor.py
apt-get install -qy python3-setuptools && \
easy_install3 watchdog && \
# clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
/usr/share/man /usr/share/groff /usr/share/info \
/usr/share/lintian /usr/share/linda /var/cache/man && \
(( find /usr/share/doc -depth -type f ! -name copyright|xargs rm || true )) && \
(( find /usr/share/doc -empty|xargs rmdir || true ))
VOLUME ["/media", "/input", "/output", "/config"]
ENV USER_ID 0
ENV GROUP_ID 0
ENV UMASK 0000
EXPOSE 3389 8080
# Set the locale, to support files that have non-ASCII characters
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
COPY startapp.sh /
RUN true && \
# Fix guacamole errors and warnings:
# SEVERE: The scratchDir you specified: /var/lib/tomcat7/work/Catalina/localhost/guacamole is unusable.
# SEVERE: Cannot find specified temporary folder at /tmp/tomcat7-tomcat7-tmp
# WARNING: Failed to create work directory [/var/lib/tomcat7/work/Catalina/localhost/_] for context []
mkdir -p /var/cache/tomcat7 /tmp/tomcat7-tomcat7-tmp /var/lib/tomcat7/work/Catalina/localhost && \
ln -s /var/lib/tomcat7/common /usr/share/tomcat7/common && \
ln -s /var/lib/tomcat7/server /usr/share/tomcat7/server && \
ln -s /var/lib/tomcat7/shared /usr/share/tomcat7/shared && \
# To find the latest version: https://www.filebot.net/download.php?mode=s&type=deb&arch=amd64
# We'll use a specific version for reproducible builds
wget --no-check-certificate -q -O /files/filebot.deb \
'https://get.filebot.net/filebot/FileBot_4.9.3/FileBot_4.9.3_universal.deb' && \
dpkg -i /files/filebot.deb && rm /files/filebot.deb && \
# Otherwise RDP rendering of the UI doesn't work right.
sed -i 's/java /java -Dsun.java2d.xrender=false /' /usr/bin/filebot && \
# Revision-lock to a specific version to avoid any surprises.
wget --no-check-certificate -q -O /files/runas.sh \
'https://raw.githubusercontent.com/coppit/docker-inotify-command/1d4b941873b670525fd159dcb9c01bb2570b0565/runas.sh' && \
chmod +x /files/runas.sh && \
wget --no-check-certificate -q -O /files/monitor.py \
'https://raw.githubusercontent.com/coppit/docker-inotify-command/c9e9c8b980d3a5ba4abfe7c1b069f684a56be6d2/monitor.py' && \
chmod +x /files/monitor.py
# Add scripts. Make sure everything is executable by $USER_ID
COPY pre-run.sh filebot.sh filebot.conf /files/
RUN chmod a+x /files/pre-run.sh
RUN chmod a+w /files/filebot.conf
ADD 50_configure_filebot.sh /etc/my_init.d/
RUN mkdir /etc/service/filebot
ADD monitor.sh /etc/service/filebot/run
RUN chmod +x /etc/service/filebot/run
RUN mkdir /etc/service/filebot-ui
ADD startapp.sh /etc/service/filebot-ui/run
RUN chmod +x /etc/service/filebot-ui/run