FROM nginx:latest

# Run updates and install curl package
RUN apt-get update && apt-get upgrade -y
RUN apt -y install curl unzip

RUN curl -sL -o awscli.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip \
    && unzip -q awscli.zip \
    && ./aws/install \
    && rm -r aws awscli.zip

COPY entrypoint.sh /usr/share/nginx/entrypoint.sh
RUN chmod +x /usr/share/nginx/entrypoint.sh

ENV NGINX_HTML_DIR=/usr/share/nginx/html
ENV S3_FOLDER=sanitized
ENV DOMAIN_BLOCKS_FILE=palo_domain_blocks.txt
ENV URL_BLOCKS_FILE=palo_url_blocks.txt
ENV IP_BLOCKS_FILE=ip_blocks.txt

# Create healthcheck
RUN echo "ok" > ${NGINX_HTML_DIR}/hello

# Expose ports
EXPOSE 80

CMD ["/bin/bash", "/usr/share/nginx/entrypoint.sh"]
