-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
58 lines (41 loc) · 1.16 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
FROM alpine:3.19 as alpine-upgrader
RUN apk upgrade --no-cache
FROM scratch as alpine-upgraded
COPY --from=alpine-upgrader / /
CMD ["/bin/sh"]
FROM alpine-upgraded as pkg-builder
RUN apk -U add \
sudo \
alpine-sdk \
ruby-dev
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
RUN chown packager /work
USER packager
RUN abuild-keygen -a -i -n
COPY --chown=packager:packager packages/ ./
RUN cd ruby-xml-simple && \
abuild -r
RUN cd ruby-rubyzip && \
abuild -r
RUN cd ruby-sablon && \
abuild -r
FROM alpine-upgraded
RUN addgroup --system sablon \
&& adduser --system --ingroup sablon sablon
RUN --mount=from=pkg-builder,source=/home/packager/packages/work,target=/packages \
--mount=from=pkg-builder,source=/etc/apk/keys,target=/etc/apk/keys \
apk add --no-cache --repository /packages \
ruby-sablon \
py3-aiohttp
ENV PYTHONUNBUFFERED 1
WORKDIR /app
USER sablon
EXPOSE 8080
COPY sablon.py .
CMD ["python3", "sablon.py"]