forked from productionwentdown/caddy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
executable file
路55 lines (43 loc) 路 1.45 KB
/
Dockerfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Build stage
#
FROM golang:1.13-alpine as build
# args
ARG version="1.0.4"
# add plugin import paths here separated by commas
# http.expires github.com/epicagency/caddy-expires
# http.filter github.com/echocat/caddy-filter
# http.ratelimit github.com/xuqingfeng/caddy-rate-limit
ARG plugins="github.com/epicagency/caddy-expires,github.com/echocat/caddy-filter,github.com/xuqingfeng/caddy-rate-limit"
ARG telemetry="false"
# build root
WORKDIR /build
# plugins
COPY plugger.go ./
# build & test
RUN apk add --no-cache git upx ca-certificates \
&& echo -e "module caddy\nrequire github.com/caddyserver/caddy v${version}" > go.mod \
&& go run plugger.go -plugins="${plugins}" -telemetry="${telemetry}" \
&& CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build \
&& upx --ultra-brute caddy \
&& ./caddy -version
#
# Final image
#
FROM scratch
# labels
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/caddy"
LABEL org.label-schema.version=${version}
LABEL org.label-schema.schema-version="1.0"
# copy binary and ca certs
COPY --from=build /build/caddy /bin/caddy
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# copy default caddyfile
COPY Caddyfile /etc/Caddyfile
# set default caddypath
ENV CADDYPATH=/etc/.caddy
VOLUME /etc/.caddy
# serve from /srv
WORKDIR /srv
EXPOSE 2015
ENTRYPOINT ["/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout", "--agree", "--email", "domain4hs@gmail.com"]