across/docker/caddy/Dockerfile.architecture

40 lines
1.2 KiB
Docker
Raw Normal View History

# 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
2021-03-18 11:35:26 +09:00
FROM --platform=${TARGETPLATFORM} alpine:3.13
LABEL maintainer="Teddysun <i@teddysun.com>"
ARG TARGETPLATFORM
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 "${TARGETPLATFORM}" \
2020-09-20 14:22:42 +09:00
&& rm -fv /root/caddy.sh \
2020-09-20 14:24:14 +09:00
&& caddy -version
# 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
VOLUME /etc/caddy
VOLUME /config
VOLUME /data
2020-11-12 16:32:39 +09:00
EXPOSE 80 443 2015
ENV TZ=Asia/Shanghai
2020-11-12 16:32:39 +09:00
CMD [ "/usr/bin/caddy", "-conf", "/etc/caddy/Caddyfile", "-agree" ]