Add plugin support and update to caddy v0.10.2
This commit is contained in:
parent
927d9344ab
commit
2edd3f7c6c
3 changed files with 20 additions and 9 deletions
25
Dockerfile
25
Dockerfile
|
@ -4,31 +4,38 @@ MAINTAINER Jan Christian Grünhage <mail@janchristiangruenhage.de>
|
||||||
ENV GOPATH /gopath
|
ENV GOPATH /gopath
|
||||||
ENV CADDY_REPO_OWNER mholt
|
ENV CADDY_REPO_OWNER mholt
|
||||||
ENV CADDY_REPO_NAME caddy
|
ENV CADDY_REPO_NAME caddy
|
||||||
ENV CADDY_BRANCH tags/v0.9.5
|
ENV CADDY_BRANCH tags/v0.10.2
|
||||||
ENV CADDYPATH /caddy
|
ENV CADDYPATH /caddy
|
||||||
ENV UID 192
|
ENV UID 192
|
||||||
ENV GID 192
|
ENV GID 192
|
||||||
|
|
||||||
RUN addgroup -g $GID -S caddy \
|
COPY plugins.txt /plugins
|
||||||
&& adduser -u $UID -g $GID -S caddy
|
|
||||||
|
|
||||||
RUN apk add --update musl \
|
RUN apk add --update musl \
|
||||||
&& apk add --no-cache build-base libcap tini go git \
|
&& apk add --no-cache build-base su-exec libcap tini go git \
|
||||||
&& mkdir -p $GOPATH/src/github.com/$CADDY_REPO_OWNER \
|
&& mkdir -p $GOPATH/src/github.com/$CADDY_REPO_OWNER \
|
||||||
&& cd $GOPATH/src/github.com/$CADDY_REPO_OWNER \
|
&& cd $GOPATH/src/github.com/$CADDY_REPO_OWNER \
|
||||||
&& git clone https://github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME \
|
&& git clone https://github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME \
|
||||||
&& cd $CADDY_REPO_NAME \
|
&& cd $CADDY_REPO_NAME \
|
||||||
&& git checkout $CADDY_BRANCH \
|
&& git checkout $CADDY_BRANCH \
|
||||||
|
&& cd caddy/caddymain \
|
||||||
|
&& export line="$(grep -n "// This is where other plugins get plugged in (imported)" < run.go | sed 's/^\([0-9]\+\):.*$/\1/')" \
|
||||||
|
&& head -n ${line} run.go > newrun.go \
|
||||||
|
&& cat /plugins >> newrun.go \
|
||||||
|
&& line=`expr $line + 1` \
|
||||||
|
&& tail -n +${line} run.go >> newrun.go \
|
||||||
|
&& rm -f run.go \
|
||||||
|
&& mv newrun.go run.go \
|
||||||
&& go get github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME/... \
|
&& go get github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME/... \
|
||||||
&& mv $GOPATH/bin/caddy /usr/bin \
|
&& mv $GOPATH/bin/caddy /usr/bin \
|
||||||
&& setcap cap_net_bind_service=+ep /usr/bin/caddy \
|
&& setcap cap_net_bind_service=+ep /usr/bin/caddy \
|
||||||
&& apk del --purge build-base go \
|
&& apk del --purge build-base go \
|
||||||
&& mkdir $CADDYPATH \
|
&& mkdir $CADDYPATH \
|
||||||
&& rm -rf $GOPATH /var/cache/apk/*
|
&& rm -rf $GOPATH /var/cache/apk/* /plugins
|
||||||
|
|
||||||
|
COPY root /
|
||||||
|
|
||||||
USER caddy
|
|
||||||
EXPOSE 2015 80 443
|
EXPOSE 2015 80 443
|
||||||
VOLUME [ "$CADDYPATH" ]
|
VOLUME ["$CADDYPATH" ]
|
||||||
WORKDIR "$CADDYPATH"
|
WORKDIR "$CADDYPATH"
|
||||||
ENTRYPOINT [ "/sbin/tini" ]
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/run.sh"]
|
||||||
CMD [ "caddy", "-quic", "--conf", "/caddy/Caddyfile" ]
|
|
||||||
|
|
1
plugins.txt
Normal file
1
plugins.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
_ "github.com/abiosoft/caddy-git"
|
3
root/usr/local/bin/run.sh
Executable file
3
root/usr/local/bin/run.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
chown -R ${UID}:${GID} /caddy
|
||||||
|
exec su-exec ${UID}:${GID} /usr/bin/caddy -quic --conf /caddy/Caddyfile
|
Loading…
Reference in a new issue