-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
73 lines (54 loc) · 2.19 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
61
62
63
64
65
66
67
68
69
70
71
72
73
# syntax=docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
RUN apk add --no-cache ca-certificates nginx
ADD --link nginx/default.conf /etc/nginx/http.d/default.conf
RUN nginx -t
RUN apk add --no-cache freshclam=1.2.2-r0
ADD --link --chmod=644 clamav/freshclam.conf /etc/clamav/freshclam.conf
VOLUME ["/var/lib/clamav"]
# Fail the build if downloading updates gets rate-limited
RUN <<EOT
set -eo pipefail
if freshclam --stdout --verbose | grep -i -e 'on cool-down until after' -e 'received error code 429 or 403'
then
printf "ERROR: %s\n" "failed to update one or more databases due to rate-limiting..."
exit 1
fi
EOT
ARG TARGETPLATFORM
RUN <<EOT
set -e
version=3.1.6.2
url=
checksum=
## Install s6-overlay scripts
url=https://github.com/just-containers/s6-overlay/releases/download/v${version}/s6-overlay-noarch.tar.xz
checksum=05af2536ec4fb23f087a43ce305f8962512890d7c71572ed88852ab91d1434e3
archive="$(basename ${url})"
wget -q -O "${archive}" "${url}"
printf "%s %s" "${checksum}" "${archive}" | sha256sum -c -
tar -C / -Jxpf "${archive}"
## Install s6-overlay binaries
case "$TARGETPLATFORM" in
"linux/amd64")
url=https://github.com/just-containers/s6-overlay/releases/download/v${version}/s6-overlay-x86_64.tar.xz
checksum=95081f11c56e5a351e9ccab4e70c2b1c3d7d056d82b72502b942762112c03d1c
;;
"linux/arm64")
url=https://github.com/just-containers/s6-overlay/releases/download/v${version}/s6-overlay-aarch64.tar.xz
checksum=3fc0bae418a0e3811b3deeadfca9cc2f0869fb2f4787ab8a53f6944067d140ee
;;
*)
printf "ERROR: %s" "invalid architecture"
exit 1
esac
archive="$(basename ${url})"
wget -q -O "${archive}" "${url}"
printf "%s %s" "${checksum}" "${archive}" | sha256sum -c -
tar -C / -Jxpf "${archive}"
rm -f "${archive}"
EOT
ADD --link --chmod=755 s6-rc.d/freshclam /etc/s6-overlay/s6-rc.d/freshclam
ADD --link --chmod=755 s6-rc.d/nginx /etc/s6-overlay/s6-rc.d/nginx
ADD --link --chmod=755 s6-rc.d/user/contents.d/* /etc/s6-overlay/s6-rc.d/user/contents.d/
ENTRYPOINT ["/init"]