2020-09-20 14:18:27 +09:00
|
|
|
# Dockerfile for caddy v1.0.5 based alpine
|
|
|
|
# Copyright (C) 2020 Teddysun <i@teddysun.com>
|
|
|
|
# Reference URL:
|
|
|
|
# https://github.com/caddyserver/caddy
|
|
|
|
# https://github.com/caddyserver/forwardproxy
|
|
|
|
|
|
|
|
FROM alpine:3.12
|
|
|
|
LABEL maintainer="Teddysun <i@teddysun.com>"
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
COPY caddy.sh /root/caddy.sh
|
|
|
|
RUN set -ex \
|
|
|
|
&& mkdir -p /config/caddy /data/caddy /etc/caddy /usr/share/caddy \
|
|
|
|
&& apk add --no-cache tzdata ca-certificates mailcap \
|
|
|
|
&& chmod +x /root/caddy.sh \
|
|
|
|
&& /root/caddy.sh \
|
2020-09-20 14:22:42 +09:00
|
|
|
&& rm -fv /root/caddy.sh \
|
2020-09-20 14:24:14 +09:00
|
|
|
&& caddy -version
|
2020-09-20 14:18:27 +09:00
|
|
|
|
|
|
|
# set up nsswitch.conf for Go's "netgo" implementation
|
|
|
|
# see: https://github.com/docker-library/golang/blob/1eb096131592bcbc90aa3b97471811c798a93573/1.14/alpine3.12/Dockerfile#L9
|
|
|
|
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
|
|
|
|
|
|
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|
|
|
|
COPY index.html /usr/share/caddy/index.html
|
|
|
|
|
|
|
|
# See https://caddyserver.com/docs/conventions#file-locations for details
|
|
|
|
ENV XDG_CONFIG_HOME /config
|
|
|
|
ENV XDG_DATA_HOME /data
|
2020-11-12 15:50:24 +09:00
|
|
|
# Let's Encrypt Agreement
|
|
|
|
ENV ACME_AGREE="false"
|
2020-09-20 14:18:27 +09:00
|
|
|
|
|
|
|
VOLUME /etc/caddy
|
|
|
|
VOLUME /config
|
|
|
|
VOLUME /data
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
EXPOSE 443
|
|
|
|
EXPOSE 2015
|
|
|
|
|
|
|
|
ENV TZ=Asia/Shanghai
|
2020-11-12 16:06:28 +09:00
|
|
|
CMD [ "/usr/bin/caddy", "--conf", "/etc/caddy/Caddyfile", "--agree=$ACME_AGREE" ]
|