Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 6965c40

Browse files
authored
refactor: dockerfile (#16)
* refactor: dockerfile * use alpine:3.19 * pin clamv/freshclam version to the same as used in vmclarrity-tools-base/vmclarity-cli images * update nginx configuration * fix: missing service dependency descriptor * fix: fail docker build on update error * fix: fail docker build on db update error
1 parent 7249ed9 commit 6965c40

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

Dockerfile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
FROM nginx:1.25.3-alpine-slim
1+
# syntax=docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021
22

3-
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community freshclam
3+
FROM alpine:3.19@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
4+
5+
RUN apk add --no-cache ca-certificates nginx
6+
7+
ADD --link nginx/default.conf /etc/nginx/http.d/default.conf
8+
9+
RUN nginx -t
10+
11+
RUN apk add --no-cache freshclam=1.2.2-r0
412

513
ADD --link --chmod=644 clamav/freshclam.conf /etc/clamav/freshclam.conf
614

15+
VOLUME ["/var/lib/clamav"]
16+
717
# Fail the build if downloading updates gets rate-limited
8-
RUN freshclam --stdout --verbose --on-update-execute=/bin/false
18+
RUN <<EOT
19+
set -eo pipefail
920

10-
ADD --link nginx/default.conf /etc/nginx/conf.d/default.conf
21+
if freshclam --stdout --verbose | grep -i -e 'on cool-down until after' -e 'received error code 429 or 403'
22+
then
23+
printf "ERROR: %s\n" "failed to update one or more databases due to rate-limiting..."
24+
exit 1
25+
fi
1126

12-
RUN nginx -t
27+
EOT
1328

1429
ARG TARGETPLATFORM
1530

@@ -48,6 +63,7 @@ RUN <<EOT
4863
wget -q -O "${archive}" "${url}"
4964
printf "%s %s" "${checksum}" "${archive}" | sha256sum -c -
5065
tar -C / -Jxpf "${archive}"
66+
rm -f "${archive}"
5167
EOT
5268

5369
ADD --link --chmod=755 s6-rc.d/freshclam /etc/s6-overlay/s6-rc.d/freshclam

nginx/default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server {
2-
listen 80;
2+
listen 80 default_server;
33
server_name localhost;
44

55
server_tokens off;

s6-rc.d/freshclam/dependencies.d/base

Whitespace-only changes.

0 commit comments

Comments
 (0)