Skip to content

Instantly share code, notes, and snippets.

@FromSi
Created June 11, 2021 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FromSi/550de47ac798bc17cce692343610224a to your computer and use it in GitHub Desktop.
Save FromSi/550de47ac798bc17cce692343610224a to your computer and use it in GitHub Desktop.
FROM python:slim
RUN apt-get update \
# -slim images strip man dirs, but java won't install unless this dir exists.
&& mkdir -p /usr/share/man/man1 \
&& apt-get install -y \
git \
imagemagick \
libreoffice-script-provider-python \
libreoffice \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& pip install unoconv==0.8.2
# additional fonts
RUN echo "deb http://httpredir.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list \
&& echo "deb http://httpredir.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list \
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
&& apt-get update \
&& apt-get install -y \
fonts-arphic-ukai \
fonts-arphic-uming \
fonts-ipafont-mincho \
fonts-ipafont-gothic \
fonts-unfonts-core \
ttf-wqy-zenhei \
ttf-mscorefonts-installer \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.4
RUN apt-get update \
&& apt-get install -y \
curl \
gnupg2 \
&& mkdir ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
&& for server in hkp://ipv4.pool.sks-keyservers.net:80 \
hkp://ha.pool.sks-keyservers.net:80 \
hkp://pgp.mit.edu:80 \
hkp://keyserver.pgp.com:80 \
; do \
gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || echo "Trying new server..." \
; done \
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& apt-get clean \
&& apt-get autoremove -y \
curl \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libpng-dev
RUN mkdir -p /home/rocketman/.cache/dconf \
&& chmod -R 777 /home/rocketman/.cache \
&& chmod -R 777 /usr/src
RUN groupadd -g 1000 rocketgroup
RUN useradd -l -u 1000 -g rocketgroup rocketman
ENV UNO_PATH /usr/lib/libreoffice
COPY requirements.txt .
RUN pip install -r requirements.txt
WORKDIR /usr/src/app
USER rocketman
CMD [ "python", "akaby-pdf/main.py" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment