FROM ubuntu:20.04
MAINTAINER hare1039 hare1039@hare1039.cloudns.cc

RUN apt update &&\
    apt install -y curl debian-keyring debian-archive-keyring apt-transport-https &&\
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - &&\
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee -a /etc/apt/sources.list.d/caddy-stable.list &&\
    apt update &&\
    apt install -y caddy ffmpeg wget wondershaper supervisor

RUN wget https://dist.ipfs.io/go-ipfs/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz &&\
    tar -xzf go-ipfs_v0.7.0_linux-amd64.tar.gz &&\
    cd go-ipfs &&\
    bash install.sh

RUN apt install -y iputils-ping iperf

COPY supervisord.conf /supervisord.conf
COPY Caddyfile /Caddyfile
COPY init.sh /init.sh

VOLUME ["/caddy", "/ipfs-mount"]

EXPOSE 4000 8000 8001 8080

ENTRYPOINT ["bash", "/init.sh"]
