From f9ca47efd23003f31894ff32cbf0909eae733321 Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 9 Feb 2024 10:40:05 +0100 Subject: [PATCH] do not build xcaddy from source in order to speed up the building Signed-off-by: Simon L --- .github/workflows/caddy-update.yml | 10 ---------- Dockerfile | 14 +++----------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/workflows/caddy-update.yml b/.github/workflows/caddy-update.yml index 84cca7a..2efa6a1 100644 --- a/.github/workflows/caddy-update.yml +++ b/.github/workflows/caddy-update.yml @@ -15,16 +15,6 @@ jobs: run: | set -x - # Xcaddy - xcaddy_version="$( - git ls-remote https://github.com/caddyserver/xcaddy v* \ - | cut -d/ -f3 \ - | sort -V \ - | grep -E "^v[0-9\.]+$" \ - | tail -1 - )" - sed -i "s|^ENV XCADDY_VERSION.*$|ENV XCADDY_VERSION $xcaddy_version|" ./Dockerfile - # caddy_hash caddy_hash="$( git ls-remote https://github.com/porech/caddy-maxmind-geolocation master \ diff --git a/Dockerfile b/Dockerfile index 0d8dded..c66fb27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,9 @@ +FROM caddy:2.7.6-builder-alpine AS builder -FROM golang:1.22.0-alpine3.18 as go - -ENV XCADDY_VERSION v0.3.5 ENV CADDY_HASH 29233e285b83dfa070d1f6889c021cb32c161b89 -# hadolint ignore=DL3018 RUN set -ex; \ - apk add --no-cache \ - build-base \ - git; \ - go install github.com/caddyserver/xcaddy/cmd/xcaddy@"$XCADDY_VERSION"; \ - chmod +x /go/bin/xcaddy; \ - /go/bin/xcaddy build --with github.com/porech/caddy-maxmind-geolocation@"$CADDY_HASH" + xcaddy build --with github.com/porech/caddy-maxmind-geolocation@"$CADDY_HASH" FROM alpine:3.19.1 @@ -31,7 +23,7 @@ RUN set -ex; \ VOLUME /data -COPY --from=go /go/caddy /usr/local/bin/caddy +COPY --from=builder /usr/bin/caddy /usr/local/bin/caddy COPY --chmod=775 start.sh /start.sh COPY --chown=33:33 Caddyfile /Caddyfile