@@ -10,7 +10,7 @@ ARG DEBIAN_FRONTEND=noninteractive
10
10
ARG caddy_version="v1.0.0"
11
11
ARG plugins="cache,expires,git,jwt,prometheus,realip,reauth"
12
12
13
- RUN apk add --no-cache --no-progress git
13
+ RUN apk add --no-cache --no-progress git ca-certificates
14
14
15
15
# caddy
16
16
RUN git clone https://github.com/mholt/caddy -b "${caddy_version}" /go/src/github.com/mholt/caddy \
@@ -38,46 +38,26 @@ RUN git clone https://github.com/cheekybits/genny /go/src/github.com/cheekybits/
38
38
RUN git clone https://github.com/marten-seemann/qpack /go/src/github.com/marten-seemann/qpack
39
39
RUN git clone https://github.com/marten-seemann/qtls /go/src/github.com/marten-seemann/qtls
40
40
41
- # build without telemetry enabled
41
+
42
+
43
+ # build with telemetry disabled
42
44
RUN cd /go/src/github.com/mholt/caddy/caddy \
43
45
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/upstream_test.go \
44
46
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/reverseproxy_test.go \
45
47
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/proxy_test.go \
46
48
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/reverseproxy.go \
47
49
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/httpserver/server.go \
48
50
&& sed -i 's/Telemetry = true/Telemetry = false/' /go/src/github.com/mholt/caddy/caddy/caddymain/run.go \
49
- && go install
51
+ && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/caddy
50
52
51
53
# test
52
54
RUN /go/bin/caddy -version
53
55
RUN /go/bin/caddy -plugins
54
56
55
- #
56
- # Compress Caddy with UPX
57
- #
58
- FROM debian:stable as compress
59
-
60
- # curl, tar
61
- RUN apt-get update && apt install -y --no-install-recommends \
62
- tar \
63
- xz-utils \
64
- curl \
65
- ca-certificates
66
-
67
- # get official upx binary
68
- RUN curl --silent --show-error --fail --location -o - \
69
- "https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz" \
70
- | tar --no-same-owner -C /usr/bin/ -xJ \
71
- --strip-components 1 upx-3.95-amd64_linux/upx
72
-
73
- # copy and compress
74
- COPY --from=build /go/bin/caddy /usr/bin/caddy
75
- RUN /usr/bin/upx --ultra-brute /usr/bin/caddy
76
-
77
57
#
78
58
# Final image
79
59
#
80
- FROM alpine:3.9.3
60
+ FROM scratch
81
61
82
62
LABEL org.label-schema.build-date=$BUILD_DATE \
83
63
org.label-schema.vcs-url="https://github.com/swarmstack/caddy.git" \
@@ -87,8 +67,8 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
87
67
MAINTAINER Mike Holloway <mikeholloway+swarmstack@gmail.com>
88
68
89
69
# copy caddy binary and ca certs
90
- COPY --from=compress /usr /bin/caddy /bin/caddy
91
- COPY --from=compress /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
70
+ COPY --from=build /go /bin/caddy /bin/caddy
71
+ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
92
72
93
73
# copy default caddyfile
94
74
COPY Caddyfile /etc/Caddyfile
0 commit comments