FROM certbot/certbot:latest

#SHELL ["/bin/ash", "-ex", "-c"]

# Install socat
RUN apk --no-cache add socat

# Copy scripts
COPY ./docker/scripts/ /opt/scripts/
RUN chmod 755 /opt/scripts/*.sh

# Expose port 380
EXPOSE 380

# The base image runs certbot itself (ENTRYPOINT ["certbot"]). Reset it, or the
# CMD below is appended as arguments to certbot instead of replacing it. Both
# directives are in exec form: a shell-form ENTRYPOINT makes docker drop CMD
# altogether, and a shell-form CMD would expand into a nested /bin/sh -c.
# Keeping the loop in CMD is what lets a one-off run replace it outright:
#   docker run --rm -v letsencrypt:/etc/letsencrypt <image> certbot certificates
ENTRYPOINT []
CMD ["/opt/scripts/entrypoint.sh"]

