-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
36 lines (29 loc) · 1.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM centos:7
MAINTAINER [email protected]
RUN yum -y install epel-release && \
yum -y install awstats httpd && \
yum clean all
RUN mkdir -p /opt/GeoIP && \
curl -L https://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz \
| gunzip -c - > /opt/GeoIP/GeoIP.dat && \
curl -L https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz \
| gunzip -c - > /opt/GeoIP/GeoLiteCity.dat
RUN useradd -M -d /var/lib/awstats awstats && \
chown awstats:awstats /var/lib/awstats /etc/awstats /run/httpd && \
bash -O extglob -c 'rm /etc/awstats/!(awstats.model.conf)'
# Log to stdout/stderr, copied from
# https://github.com/docker-library/httpd/blob/0e4a0b59e1f4e2a5a14ca197516beb2d4df1ffb8/2.4/alpine/Dockerfile#L78
RUN \
sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/awstats.conf && \
sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
-e 's!^(\s*Listen)\s+\S+!\1 8080!g' \
/etc/httpd/conf/httpd.conf && \
echo "RedirectMatch ^/$ /awstats/awstats.pl?config=localhost" > /etc/httpd/conf.d/welcome.conf
COPY entrypoint.pl /
USER awstats
EXPOSE 8080
# Awstats database
VOLUME ["/var/lib/awstats/"]
ENTRYPOINT ["/entrypoint.pl"]