FROM debian:bullseye-slim AS downloader

RUN apt update && \
    apt install -y curl wget

ADD downloader.sh downloader.sh

RUN sh downloader.sh

FROM debian:bullseye-slim

RUN apt update && \
    apt install -y ca-certificates && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=downloader /smartdns.deb /

RUN dpkg -i *.deb && rm *.deb && mkdir -p /var/log/smartdns

EXPOSE 53/tcp
EXPOSE 53/udp

VOLUME [ "/etc/smartdns" ]

ENTRYPOINT [ "smartdns" ]

CMD ["-f -c /etc/smartdns/smartdns.conf"]
