FROM httpd:2.4-alpine # Install some fun utilities (because why not?) RUN apk add --no-cache \ fortune \ figlet \ && echo "#!/bin/sh" > /usr/local/bin/blame-dustin \ && echo 'echo "This is Dustin'\''s fault. Obviously."' >> /usr/local/bin/blame-dustin \ && chmod +x /usr/local/bin/blame-dustin # Create a custom error page that blames Dustin for everything RUN echo '
This page doesn'\''t exist. You know who to blame.
' > /usr/local/apache2/htdocs/404.html \
&& echo " _____ _ _ _ " >> /usr/local/apache2/htdocs/404.html \
&& echo " | __ \ | | (_) | | " >> /usr/local/apache2/htdocs/404.html \
&& echo " | | | | ___| |_ _ _ __ | |_ " >> /usr/local/apache2/htdocs/404.html \
&& echo " | | | |/ _ \ __| | '_ \| __|" >> /usr/local/apache2/htdocs/404.html \
&& echo " | |__| | __/ |_| | | | | |_ " >> /usr/local/apache2/htdocs/404.html \
&& echo " |_____/ \___|\__|_|_| |_|\__|" >> /usr/local/apache2/htdocs/404.html \
&& echo " " >> /usr/local/apache2/htdocs/404.html \
&& echo " It's Dustin's fault. Obviously." >> /usr/local/apache2/htdocs/404.html \
&& echo 'Go back to blaming Dustin properly
' >> /usr/local/apache2/htdocs/404.html # Copy our website files COPY index.html /usr/local/apache2/htdocs/ COPY cgi-bin/blame-dustin.cgi /usr/local/apache2/cgi-bin/ # Enable CGI and set up custom error pages RUN sed -i '/LoadModule cgid_module/s/^#//g' /usr/local/apache2/conf/httpd.conf \ && sed -i '/ScriptAlias \/cgi-bin\//s/^#//g' /usr/local/apache2/conf/httpd.conf \ && sed -i '/Dustin fucked up the server. Again.
"' >> /usr/local/apache2/conf/httpd.conf \ && echo 'ErrorDocument 403 "Dustin says you can'\''t see this. What an asshole.
"' >> /usr/local/apache2/conf/httpd.conf # Make sure CGI scripts are executable RUN chmod +x /usr/local/apache2/cgi-bin/blame-dustin.cgi # Expose port 80 EXPOSE 80 # Start Apache in foreground CMD ["httpd-foreground"]