aboutsummaryrefslogtreecommitdiff
path: root/awstats/Dockerfile
blob: 18a679a68d75bf148dcb933fc75c32690e28ddff (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM alpine:edge
LABEL maintainer="Mike Crute <mike@crute.us>"


# TODO: Is this really needed?
# apk add perl-net-ssleay

RUN set -euxo pipefail; \
    # Install build dependencies
    apk add --virtual .build-deps \
        build-base \
        git \
        perl-app-cpanminus \
        perl-dev \
        wget \
    ; \
    apk add \
        curl \
    ; \
    \
    # Install awstats
    git clone https://github.com/eldy/awstats.git /opt/awstats; \
    cpanm -n Net::IP Net::DNS; \
    mkdir /etc/awstats; \
    \
    # Install MaxMind GeoIP2 library
    apk add perl-net-ssleay; \
    cpanm -n \
        Data::Validate::IP \
        HTTP::Headers \
        HTTP::Request \
        HTTP::Response \
        HTTP::Status \
        JSON::MaybeXS \
        List::SomeUtils \
        LWP::Protocol::https \
        LWP::UserAgent \
        MaxMind::DB::Metadata \
        MaxMind::DB::Reader \
        Moo \
        Moo::Role \
        namespace::clean \
        Params::Validate \
        Path::Class \
        Sub::Quote \
        Test::Fatal \
        Test::Number::Delta \
        Throwable::Error \
        Try::Tiny URI \
    ; \
    \
    git clone https://github.com/maxmind/GeoIP2-perl.git /tmp/GeoIP2-perl; \
    cd /tmp/GeoIP2-perl; \
    perl Makefile.PL; \
    make all install; \
    mkdir /geoip; \
    rm -rf /tmp/GeoIP2-perl; \
    \
    # Cleanup
    apk del .build-deps; \
    rm -rf /root/.cpanm/ /var/cache/apk/*;

ADD main /serve
ADD build.sh /build

CMD [ "/serve" ]