From afb6e8df0cc636830a9f77f91fa2840243b1c38f Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Mon, 8 Jul 2024 22:34:27 -0300 Subject: [PATCH] Dockerfile linter --- .hadolint.yml | 3 +++ Dockerfile | 33 +++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 .hadolint.yml diff --git a/.hadolint.yml b/.hadolint.yml new file mode 100644 index 0000000..eee9f9b --- /dev/null +++ b/.hadolint.yml @@ -0,0 +1,3 @@ +ignored: + - DL3018 + - DL3059 diff --git a/Dockerfile b/Dockerfile index 4675fed..d436586 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,13 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build -RUN apk update && apk add crystal shards yaml-dev openssl-dev zlib-dev libxml2-dev make && apk cache clean +FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.20 AS build +RUN apk add --no-cache \ + crystal \ + shards \ + yaml-dev \ + openssl-dev \ + zlib-dev \ + libxml2-dev \ + make +RUN rm -rf /var/cache/apk/* RUN addgroup -S app && adduser app -S -G app WORKDIR /home/app COPY shard.yml Makefile ./ @@ -9,8 +17,22 @@ COPY runtimes/ runtimes/ RUN make # RUN strip bin/* -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship -RUN apk update && apk add caddy nss-tools multirun docker openssl zlib yaml pcre2 gc libevent libgcc libxml2 ttyd && apk cache clean +FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.20 AS ship +RUN apk add --no-cache \ + caddy \ + nss-tools \ + multirun \ + docker \ + openssl \ + zlib \ + yaml \ + pcre2 \ + gc \ + libevent \ + libgcc \ + libxml2 \ + ttyd +RUN rm -rf /var/cache/apk/* # Unprivileged user RUN addgroup -S app && adduser app -S -G app @@ -21,7 +43,6 @@ COPY public/ public/ COPY --from=build /home/app/bin/faaso-daemon /home/app/bin/faaso /usr/bin/ # Mount points for persistent data -RUN mkdir /secrets -RUN mkdir /config +RUN mkdir /secrets /config CMD ["/usr/bin/multirun", "-v", "faaso-daemon", "caddy run --config config/Caddyfile"]