moviewyrm/Dockerfile
Joel Bradshaw 284eb620dd Add Source Han font for preview generation to Docker image
Include the license and a README explaining things in the repo itself.

Depending on an external source for this is intended to be temporary,
the goal is to have a Bookywrm-managed source for these, but this should
be stable enough for now.

We build it into the Dockerfile to make it available without adding it
to the git repo itself, because git history is forever and we don't want
to bake large files into the history.

Theoretically it would make sense to gate this download on the
ENABLE_PREVIEW_IMAGES environment variable, but ENV variables aren't
available at Docker image build time (for sensible reasons), so we just
unconditonally download it.

This does mean users will ultimately download it anyway, but the benefit
to doing this over adding it to the git history is that if we switch
fonts, or update this one, or change strategies altogether, this version
of the font will no longer have to be downloaded.

Additionally, the font won't be downloaded until the application is
actually built, which involves a bunch of other downloading (of Docker
images and the like), so it's a reasonable time to do it.
2022-01-24 23:16:14 -08:00

18 lines
620 B
Docker

FROM python:3.9
ENV PYTHONUNBUFFERED 1
RUN mkdir /app /app/static /app/images
WORKDIR /app
# Use RUN curl because ADD will re-download the file every time to make sure it
# hasn't changed, which is exactly what we don't want
RUN mkdir -p /app/static/fonts/source_han_sans
RUN curl \
https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc \
-o /app/static/fonts/source_han_sans/SourceHanSans-VF.ttf.ttc
COPY requirements.txt /app/
RUN pip install -r requirements.txt --no-cache-dir
RUN apt-get update && apt-get install -y gettext libgettextpo-dev tidy && apt-get clean