forked from 4teamwork/weasyprint-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (37 loc) · 1.05 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
FROM alpine:3.19 as pkg-builder
RUN apk -U add \
sudo \
alpine-sdk \
apkbuild-pypi
RUN mkdir -p /var/cache/distfiles && \
adduser -D packager && \
addgroup packager abuild && \
chgrp abuild /var/cache/distfiles && \
chmod g+w /var/cache/distfiles && \
echo "packager ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
WORKDIR /work
USER packager
RUN abuild-keygen -a -i -n
COPY --chown=packager:packager packages/ ./
RUN cd py3-pydyf && \
abuild -r && \
cd ../py3-weasyprint && \
abuild -r
FROM alpine:3.19
RUN addgroup --system weasyprint \
&& adduser --system --ingroup weasyprint weasyprint
COPY --from=pkg-builder /home/packager/packages/work/ /packages/
COPY --from=pkg-builder /home/packager/.abuild/*.pub /etc/apk/keys/
RUN apk add --no-cache --repository /packages \
font-liberation \
font-liberation-sans-narrow \
ttf-linux-libertine \
python3 \
py3-aiohttp \
py3-weasyprint
ENV PYTHONUNBUFFERED 1
WORKDIR /app
USER weasyprint
EXPOSE 8080
COPY server.py .
CMD ["python3", "server.py"]