Created
April 18, 2023 03:17
-
-
Save xjoker/535203f323f3bbc27f2d8788875e5d7d to your computer and use it in GitHub Desktop.
build caddy webdav
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
FROM golang:1.20.3 AS build | |
ARG version | |
ARG xcaddy_arg | |
WORKDIR /src | |
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest | |
RUN xcaddy build ${version} ${xcaddy_arg} | |
FROM alpine:3.16 AS base | |
ARG version | |
WORKDIR /src | |
COPY --from=build /src/ . | |
ENV CADDY_VERSION ${version} | |
RUN mkdir -p \ | |
/config/caddy \ | |
/data/caddy \ | |
/etc/caddy \ | |
/usr/share/caddy; \ | |
wget -O /etc/caddy/Caddyfile "https://raw.githubusercontent.com/caddyserver/dist/${version}/config/Caddyfile"; \ | |
wget -O /usr/share/caddy/index.html "https://raw.githubusercontent.com/caddyserver/dist/${version}/welcome/index.html"; \ | |
cp /src/caddy /usr/bin/caddy; \ | |
chmod +x /usr/bin/caddy; \ | |
caddy version | |
ENV XDG_CONFIG_HOME /config | |
ENV XDG_DATA_HOME /data | |
LABEL org.opencontainers.image.version=${version} | |
LABEL org.opencontainers.image.title=Caddy | |
EXPOSE 80 | |
EXPOSE 443 | |
EXPOSE 443/udp | |
EXPOSE 2019 | |
WORKDIR /srv | |
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker build --build-arg version="v2.6.4" --build-arg xcaddy_arg="--with github.com/mholt/caddy-webdav" -t xjoker/caddy-webdav:v2.6.4 .