forked from productionwentdown/caddy
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build to support Caddy 1.0.0. Now produces alpine:3.9.3 image …
…instead of scratch
- Loading branch information
Mike Holloway
committed
May 1, 2019
1 parent
537cdcd
commit f349a1d
Showing
2 changed files
with
50 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ FROM golang:1.12-alpine as build | |
|
||
ARG BUILD_DATE | ||
ARG VCS_REF | ||
ARG DEBIAN_FRONTED=noninteractive | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG caddy_version="v0.11.5" | ||
ARG caddy_version="v1.0.0" | ||
ARG plugins="cache,expires,git,jwt,prometheus,realip,reauth" | ||
|
||
RUN apk add --no-cache --no-progress git | ||
|
@@ -28,17 +28,32 @@ RUN for plugin in $(echo $plugins | tr "," " "); do \ | |
done | ||
|
||
# builder dependency | ||
RUN git clone https://github.com/caddyserver/builds /go/src/github.com/caddyserver/builds | ||
RUN git clone https://github.com/dustin/go-humanize /go/src/github.com/dustin/go-humanize | ||
RUN git clone https://github.com/gorilla/websocket /go/src/github.com/gorilla/websocket | ||
RUN git clone https://github.com/jimstudt/http-authentication /go/src/github.com/jimstudt/http-authentication | ||
RUN git clone https://github.com/naoina/toml /go/src/github.com/naoina/toml | ||
RUN git clone https://github.com/naoina/go-stringutil /go/src/github.com/naoina/go-stringutil | ||
RUN git clone https://github.com/VividCortex/ewma /go/src/github.com/VividCortex/ewma | ||
RUN git clone https://github.com/cheekybits/genny /go/src/github.com/cheekybits/genny | ||
RUN git clone https://github.com/marten-seemann/qpack /go/src/github.com/marten-seemann/qpack | ||
RUN git clone https://github.com/marten-seemann/qtls /go/src/github.com/marten-seemann/qtls | ||
|
||
# build with telemetry enabled | ||
RUN cd /go/src/github.com/mholt/caddy/caddy \ | ||
&& git checkout -f \ | ||
&& go run build.go \ | ||
&& mv caddy /go/bin | ||
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/upstream_test.go \ | ||
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/reverseproxy_test.go \ | ||
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/proxy_test.go \ | ||
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/proxy/reverseproxy.go \ | ||
&& sed -i 's/h2quic/http3/g' /go/src/github.com/mholt/caddy/caddyhttp/httpserver/server.go \ | ||
&& go install | ||
#&& mv caddy /go/bin | ||
|
||
# test | ||
RUN /go/bin/caddy -version | ||
RUN /go/bin/caddy -plugins | ||
|
||
# | ||
# Compress Caddy with upx | ||
# Compress Caddy with UPX | ||
# | ||
FROM debian:stable as compress | ||
|
||
|
@@ -59,14 +74,10 @@ RUN curl --silent --show-error --fail --location -o - \ | |
COPY --from=build /go/bin/caddy /usr/bin/caddy | ||
RUN /usr/bin/upx --ultra-brute /usr/bin/caddy | ||
|
||
# test | ||
RUN /usr/bin/caddy -version | ||
RUN /usr/bin/caddy -plugins | ||
|
||
# | ||
# Final image | ||
# | ||
FROM scratch | ||
FROM alpine:3.9.3 | ||
|
||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.vcs-url="https://github.com/swarmstack/caddy.git" \ | ||
|
@@ -78,7 +89,6 @@ MAINTAINER Mike Holloway <[email protected]> | |
# copy caddy binary and ca certs | ||
COPY --from=compress /usr/bin/caddy /bin/caddy | ||
COPY --from=compress /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=compress /usr/bin/curl /bin/curl | ||
|
||
# copy default caddyfile | ||
COPY Caddyfile /etc/Caddyfile | ||
|
@@ -92,4 +102,4 @@ VOLUME ["/www"] | |
WORKDIR /www | ||
COPY index.html /www/index.html | ||
|
||
CMD ["/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout", "-agree", "--root", "/www"] | ||
CMD ["/bin/caddy", "-conf", "/etc/Caddyfile", "-log", "stdout", "-agree", "-root", "/www"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters