-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Dockerfile
60 lines (43 loc) · 2.13 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
FROM python:3.8.17-alpine as base
####
FROM base as builder
RUN apk update && \
apk add --virtual build-deps make git g++ python3-dev musl-dev jpeg-dev zlib-dev libevent-dev file-dev libffi-dev openssl && \
apk add postgresql-dev libxml2-dev libxslt-dev
# PDF Generation: weasyprint (libffi-dev jpeg-dev already included above)
RUN apk add --virtual gdk-pixbuf-dev
RUN apk --no-cache add postgresql-libs ca-certificates libxslt jpeg zlib file libxml2
# PDF Generation: weasyprint
RUN apk --no-cache add cairo-dev pango-dev ttf-opensans
# Note: The custom PyPI repo is for AlpineOS only, where Python packages are compiled with musl libc. Don't use it on glibc Linux.
ENV POETRY_HOME=/opt/poetry \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PIP_EXTRA_INDEX_URL=https://pypi.fury.io/fossasia/
ENV PATH="$POETRY_HOME/bin:$PATH"
RUN set -eo pipefail; wget -O - https://install.python-poetry.org | python -
WORKDIR /opt/pysetup
COPY pyproject.toml ./
COPY poetry.lock ./
RUN poetry export -f requirements.txt --without-hashes --only main | poetry run pip install -r /dev/stdin
####
FROM base
# these libs are necessary for operation
RUN apk --no-cache add libmagic cairo pango ttf-opensans && \
apk --no-cache add postgresql-libs libxslt jpeg zlib libxml2 # those *might* be useful
# Various fonts for proper name printing
RUN apk --no-cache add fontconfig font-noto-gujarati font-noto-kannada && \
apk --no-cache add font-noto-osage font-noto-kayahli font-noto-oriya && \
apk --no-cache add font-noto-telugu font-noto-tamil font-noto-bengali && \
apk --no-cache add font-noto-malayalam font-noto-arabic font-noto-extra && \
apk --no-cache add font-noto-armenian font-noto-cherokee font-noto-devanagari && \
apk --no-cache add font-noto-ethiopic font-noto-georgian font-noto-hebrew && \
apk --no-cache add font-noto-lao font-noto-thaana font-noto-thai font-noto-cjk
RUN fc-cache -f
COPY --from=builder /opt/pysetup/.venv /opt/pysetup/.venv
ENV PATH="/opt/pysetup/.venv/bin:$PATH"
WORKDIR /data/app
ADD . .
RUN ["sh", "scripts/l10n.sh", "generate"]
EXPOSE 8080
ENTRYPOINT ["sh", "scripts/container_start.sh"]