forked from caddyserver/caddy-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.builder.tmpl
35 lines (30 loc) · 1.48 KB
/
Dockerfile.builder.tmpl
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
{{ .base | strings.TrimSpace }}
RUN apk add --no-cache \
ca-certificates \
git \
libcap
ENV XCADDY_VERSION v{{ .xcaddy_config.version }}
# Configures xcaddy to build with this version of Caddy
ENV CADDY_VERSION v{{ .config.caddy_version }}
# Configures xcaddy to not clean up post-build (unnecessary in a container)
ENV XCADDY_SKIP_CLEANUP 1
# Sets capabilities for output caddy binary to be able to bind to privileged ports
ENV XCADDY_SETCAP 1
RUN set -eux; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) binArch='amd64'; checksum='{{ .xcaddy_config.checksums.amd64 }}' ;; \
armhf) binArch='armv6'; checksum='{{ .xcaddy_config.checksums.arm32v6 }}' ;; \
armv7) binArch='armv7'; checksum='{{ .xcaddy_config.checksums.arm32v7 }}' ;; \
aarch64) binArch='arm64'; checksum='{{ .xcaddy_config.checksums.arm64v8 }}' ;; \
ppc64el|ppc64le) binArch='ppc64le'; checksum='{{ .xcaddy_config.checksums.ppc64le }}' ;; \
s390x) binArch='s390x'; checksum='{{ .xcaddy_config.checksums.s390x }}' ;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\
esac; \
wget -O /tmp/xcaddy.tar.gz "https://github.com/caddyserver/xcaddy/releases/download/v{{ .xcaddy_config.version }}/xcaddy_{{ .xcaddy_config.version }}_linux_${binArch}.tar.gz"; \
echo "$checksum /tmp/xcaddy.tar.gz" | sha512sum -c; \
tar x -z -f /tmp/xcaddy.tar.gz -C /usr/bin xcaddy; \
rm -f /tmp/xcaddy.tar.gz; \
chmod +x /usr/bin/xcaddy;
COPY caddy-builder.sh /usr/bin/caddy-builder
WORKDIR /usr/bin