FROM alpine:3.21.2

LABEL org.opencontainers.image.authors="alier@student.42mulhouse.fr"

RUN apk add nginx openssl curl && rm /etc/nginx/http.d/default.conf

COPY		./conf/nginx.conf /etc/nginx/nginx.conf
COPY		./conf/example.com.conf /etc/nginx/http.d/example.com.conf
COPY		./tools/setup_nginx.sh /setup_nginx.sh

HEALTHCHECK --start-period=5s \
    CMD curl "https://$DOMAIN_NAME" --insecure --fail || exit 1

EXPOSE 443

ENTRYPOINT ["sh", "setup_nginx.sh"]