Skip to content

Instantly share code, notes, and snippets.

@shtrom
Last active April 25, 2023 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shtrom/bfaac4b6d9089e24bb495f4948d1f0f0 to your computer and use it in GitHub Desktop.
Save shtrom/bfaac4b6d9089e24bb495f4948d1f0f0 to your computer and use it in GitHub Desktop.
A Dockerfile to proccess Apache Server-side Include and dump the fully rendered static files https://blog.narf.ssji.net/2023/04/24/render-apache-server-side-includes-docker/
# usage:
#
# docker build -t ssi-extractor - < Dockerfile
# docker run -v ./www:/usr/local/apache2/htdocs/ -v ./out:/out ssi-extractor
FROM httpd:alpine
RUN apk update \
&& apk add wget
RUN sed -i \
-e 's/#LoadModule include_module/LoadModule include_module/' \
-e 's/#LoadModule negotiation_module/LoadModule negotiation_module/' \
-e 's/Options Indexes FollowSymLinks/& Includes MultiViews/' \
-e 's/#\(Add.*shtml\)/\1/' \
-e 's/DirectoryIndex index.html/DirectoryIndex index.shtml/' \
/usr/local/apache2/conf/httpd.conf \
&& rm /usr/local/apache2/htdocs/index.html
RUN mkdir /out \
&& echo '#!/bin/sh' > /cmd.sh \
&& echo 'httpd-foreground &' >> /cmd.sh \
&& echo 'sleep 3; cd /out; wget -rl 0 -nH -E --accept-regex "/[^.]*(.html)?$" http://localhost/' >> /cmd.sh \
&& chmod a+x /cmd.sh
CMD ["/cmd.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment