Skip to content

Commit bfd0c0f

Browse files
committed
update unoconv image to debian buster
* Install LibreOffice via apt-get instead of downloading the .debs from LO's repo. Installing LO's packages has become troublesome, since they no longer make previous patch-level releases available for download. Installing from apt allows us to stop having to update the Dockerfile after every patch release. * The java dependencies installed by libreoffice require the presence of /usr/share/man/man1/, which is stripped out of the -slim images. Manually create this directory at the top of the Dockerfile. * Update unoconv invocation command. Debian's version of libreoffice does not ship with a `python` binary in the libreoffice sharedir. Instead, it installs python as a separate package (`python3.7`), which can be made to work with unoconv by setting the `UNO_PATH` envvar. * Update base python image to 3.7. Not necessary, but you gotta grab those chuckles where you can.
1 parent 7435b3e commit bfd0c0f

File tree

1 file changed

+11
-37
lines changed

1 file changed

+11
-37
lines changed

unoconv/Dockerfile

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
FROM python:3.6-slim-stretch
1+
FROM python:3.7-slim-buster
22

33
RUN apt-get update \
4+
# -slim images strip man dirs, but java won't install unless this dir exists.
5+
&& mkdir -p /usr/share/man/man1 \
46
&& apt-get install -y \
57
git \
68
imagemagick \
79
libreoffice-script-provider-python \
10+
libreoffice \
811
&& apt-get clean \
912
&& apt-get autoremove -y \
10-
&& rm -rf /var/lib/apt/lists/*
13+
&& rm -rf /var/lib/apt/lists/* \
14+
&& pip install unoconv==0.8.2
1115

1216
# additional fonts
13-
RUN echo "deb http://httpredir.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list \
14-
&& echo "deb http://httpredir.debian.org/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list \
15-
&& echo "deb http://security.debian.org/ stretch/updates main contrib non-free" >> /etc/apt/sources.list \
17+
RUN echo "deb http://httpredir.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list \
18+
&& echo "deb http://httpredir.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list \
19+
&& echo "deb http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list \
1620
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
1721
&& apt-get update \
1822
&& apt-get install -y \
@@ -55,42 +59,12 @@ RUN apt-get update \
5559
RUN usermod -d /home www-data \
5660
&& chown www-data:www-data /home
5761

58-
ENV LIBREOFFICE_VERSION 6.1.5
59-
ENV LIBREOFFICE_ARCHIVE LibreOffice_6.1.5_Linux_x86-64_deb.tar.gz
60-
ENV LIBREOFFICE_MIRROR_URL https://download.documentfoundation.org/libreoffice/stable/
61-
RUN apt-get update \
62-
&& apt-get install -y \
63-
curl \
64-
gnupg2 \
65-
&& for server in hkp://ipv4.pool.sks-keyservers.net:80 \
66-
hkp://ha.pool.sks-keyservers.net:80 \
67-
hkp://pgp.mit.edu:80 \
68-
hkp://keyserver.pgp.com:80 \
69-
; do \
70-
gpg --keyserver "$server" --recv-keys AFEEAEA3 && break || echo "Trying new server..." \
71-
; done \
72-
&& curl -SL "$LIBREOFFICE_MIRROR_URL/$LIBREOFFICE_VERSION/deb/x86_64/$LIBREOFFICE_ARCHIVE" -o $LIBREOFFICE_ARCHIVE \
73-
&& curl -SL "$LIBREOFFICE_MIRROR_URL/$LIBREOFFICE_VERSION/deb/x86_64/$LIBREOFFICE_ARCHIVE.asc" -o $LIBREOFFICE_ARCHIVE.asc \
74-
&& gpg --verify "$LIBREOFFICE_ARCHIVE.asc" \
75-
&& mkdir /tmp/libreoffice \
76-
&& tar -xvf "$LIBREOFFICE_ARCHIVE" -C /tmp/libreoffice/ --strip-components=1 \
77-
&& dpkg -i /tmp/libreoffice/**/*.deb \
78-
&& rm $LIBREOFFICE_ARCHIVE* \
79-
&& rm -Rf /tmp/libreoffice \
80-
&& apt-get clean \
81-
&& apt-get autoremove -y \
82-
curl \
83-
gnupg2 \
84-
&& rm -rf /var/lib/apt/lists/*
85-
86-
RUN pip install unoconv==0.8.2
87-
88-
ENV UNO_PATH=/opt/libreoffice6.1
62+
ENV UNO_PATH /usr/lib/libreoffice
8963

9064
COPY entrypoint.sh /entrypoint.sh
9165
RUN chmod +x /entrypoint.sh
9266
ENTRYPOINT ["/entrypoint.sh"]
9367

9468
EXPOSE 2002
9569

96-
CMD ["gosu", "www-data", "/opt/libreoffice6.1/program/python", "-u", "/usr/local/bin/unoconv", "--listener", "--server=0.0.0.0", "--port=2002", "-vvv"]
70+
CMD ["gosu", "www-data", "/usr/bin/python3.7", "/usr/local/bin/unoconv", "--listener", "--server=0.0.0.0", "--port=2002", "-vvv"]

0 commit comments

Comments
 (0)