-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (22 loc) · 817 Bytes
/
Copy pathDockerfile
File metadata and controls
24 lines (22 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ARG CADDY_BUILDER_VERSION=2
ARG CADDY_VERSION=2
FROM --platform=$BUILDPLATFORM caddy:${CADDY_BUILDER_VERSION}-builder-alpine AS build
WORKDIR /tmp/source
ARG CADDY_VERSION
ARG TARGETARCH
RUN --mount=type=bind,target=/tmp/source \
--mount=type=cache,target=/go/pkg/mod,sharing=locked \
--mount=type=tmpfs,target=/root/.cache/go-build \
<<EOT
export GOOS=linux
export GOARCH=${TARGETARCH}
xcaddy build v${CADDY_VERSION} \
--output /usr/bin/caddy-${GOOS}-${GOARCH} \
$(xargs -a "./modules.txt" -I {} echo --with {}) \
$(test -f "./replace.txt" && xargs -a "./replace.txt" -I {} echo --replace {})
EOT
FROM caddy:${CADDY_VERSION}-alpine
RUN apk add -Uu --no-cache ca-certificates
ARG TARGETARCH
COPY --link --from=build /usr/bin/caddy-linux-${TARGETARCH} /usr/bin/caddy
RUN caddy list-modules