FROM caddy:2-alpine # Install required tools for hash calculation and CSP updates RUN apk add --no-cache bash coreutils findutils grep sed xxd perl gawk # Copy update scripts first COPY update-csp-hashes.sh /srv/update-csp-hashes.sh COPY caddy.sh /srv/caddy.sh # Copy Caddyfile and static content COPY Caddyfile /etc/caddy/Caddyfile # Also copy to /srv for compatibility with the script COPY Caddyfile /srv/Caddyfile COPY index.html /srv/ COPY theme.js /srv/ COPY utils.js /srv/ COPY styles.css /srv/ COPY favicon.ico /srv/ COPY includes.js /srv/ COPY papaparse.min.js /srv/ # Copy one-pager-tools directory COPY one-pager-tools /srv/one-pager-tools/ # Copy includes directory COPY includes/ /srv/includes/ # Copy stories directory COPY stories/ /srv/stories/ # Set working directory WORKDIR /srv # Run the update-csp-hashes.sh script to update CSP hashes RUN chmod +x /srv/caddy.sh /srv/update-csp-hashes.sh && \ cd /srv && \ ./update-csp-hashes.sh # Expose port 8080 EXPOSE 8080 # Run Caddy CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]