Skip to content

Commit

Permalink
pass httpd listen port as environment variable
Browse files Browse the repository at this point in the history
relates to #44
  • Loading branch information
pabra committed Dec 9, 2023
1 parent e2d4f23 commit 03863ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ ARG AWSTATS_VERSION=7.9-r0

RUN apk add --no-cache awstats=${AWSTATS_VERSION} tzdata=${TZDATA_VERSION} \
&& touch /etc/awstats/awstats.conf \
&& chmod g+w /etc/awstats/awstats.conf
&& chmod g+w /etc/awstats/awstats.conf \
&& sed 's/^Listen 80/Listen $HTTPD_PORT/' /usr/local/apache2/conf/httpd.conf > /usr/local/apache2/conf/httpd_env.conf

COPY awstats_env.conf /etc/awstats/
COPY awstats_httpd.conf /usr/local/apache2/conf/
COPY awstats_httpd_env.conf /usr/local/apache2/conf/
COPY entrypoint.sh /usr/local/bin/

ENV AWSTATS_CONF_LOGFILE="/var/local/log/access.log"
Expand All @@ -36,6 +37,7 @@ ENV AWSTATS_CONF_SITEDOMAIN="my_website"
ENV AWSTATS_CONF_HOSTALIASES="localhost 127.0.0.1 REGEX[^.*$]"
ENV AWSTATS_CONF_INCLUDE="."
ENV AWSTATS_CONF_ALLOWFULLYEARVIEW=2
ENV HTTPD_PORT="80"

ENTRYPOINT ["entrypoint.sh"]
CMD ["httpd-foreground"]
2 changes: 1 addition & 1 deletion awstats_httpd.conf → awstats_httpd_env.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<VirtualHost *:80>
<VirtualHost *:$HTTPD_PORT>
LoadModule cgi_module modules/mod_cgi.so
LoadModule perl_module /usr/lib/apache2/mod_perl.so

Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ if [ -x /usr/local/bin/autorun.sh ]; then
fi

envsubst </etc/awstats/awstats_env.conf >/etc/awstats/awstats.conf
envsubst </usr/local/apache2/conf/awstats_httpd_env.conf >/usr/local/apache2/conf/awstats_httpd.conf
envsubst </usr/local/apache2/conf/httpd_env.conf >/usr/local/apache2/conf/httpd.conf

exec "$@"

0 comments on commit 03863ed

Please sign in to comment.