| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- FROM httpd:alpine
- MAINTAINER You <you@somedomain.com>
- COPY $PWD/build/docker/httpd/httpd.conf /usr/local/apache2/conf/httpd.conf
- # Install curl, just for healthchecking, without using local cache for the package lists
- RUN apk --no-cache add curl
- # Define a healthcheck that tests the root URL of the site
- HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:80/ || exit 1
- # Remove any files that may be in the public htdocs directory already.
- RUN rm -r /usr/local/apache2/htdocs/*
- # Enable the rewrite module in apache2.
- RUN sed -i \
- 's/#LoadModule rewrite_module modules\/mod_rewrite.so/LoadModule rewrite_module modules\/mod_rewrite.so/g' \
- /usr/local/apache2/conf/httpd.conf
- # RUN sed -i \
- # -e 's/^#\(Include .*httpd-ssl.conf\)/\1/' \
- # -e 's/^#\(LoadModule .*mod_ssl.so\)/\1/' \
- # -e 's/^#\(LoadModule .*mod_socache_shmcb.so\)/\1/' \
- # /usr/local/apache2/conf/httpd.conf
- # Append to the published directory, that we want to rewrite any request that is not an actual file
- # to the index.html page.
- RUN sed -i '/<Directory "\/usr\/local\/apache2\/htdocs">/a### Rewrite rule was written from the Dockerfile when building the image ###\n\
- DirectoryIndex index.html\n\
- RewriteEngine on\n\
- RewriteCond %{REQUEST_FILENAME} -s [OR]\n\
- RewriteCond %{REQUEST_FILENAME} -d\n\
- RewriteRule ^.*$ - [NC,L]\n\
- RewriteRule ^(.*) index.html [NC,L]\n' \
- /usr/local/apache2/conf/httpd.conf
- # Comment out the default config that handles requests to /.htaccess and /.ht* with a special error message,
- # Angular will handle all routing
- RUN sed -i '/<Files "\.ht\*">/,/<\/Files>/c# This was commented out from the Dockerfile\n# <Files ".ht*">\n# Require all denied\n# <\/Files>' \
- /usr/local/apache2/conf/httpd.conf
- # Copy all the files from the docker build context into the public htdocs of the apache container.
- # COPY ./ /usr/local/apache2/htdocs/
- COPY $PWD/angular-client/dist/fatboar /usr/local/apache2/htdocs/
- # Change owner of the publicly available files to root user and daemon group. Httpd threads run as daemon dist/fatboar .
- RUN chown -R root:daemon \
- /usr/local/apache2/htdocs/*
- # Ensure that the files can only be read, even by the httpd server.
- RUN chmod -R 440 \
- /usr/local/apache2/htdocs/*
-
- # Ensure for all the directories created, that the files within them can be read. We need the
- # execution access privilege on the directory for this. Dynamically apply this to all directories
- # at least one level into the served root. (-mindepth 1, otherwise the served directory itself
- # would be included - no need for that.
- RUN find /usr/local/apache2/htdocs/ -mindepth 1 -type d -exec chmod +x {} \;
- #RUN mkdir -p /usr/local/apache2/conf/sites/
- EXPOSE 80
- CMD ["httpd", "-D", "FOREGROUND"]
|