Build library on alpine inserts wrong path to httpd.conf
mahnunchik opened this issue · 2 comments
mahnunchik commented
FROM alpine:3.8
RUN apk add --no-cache \
apache2
# install mod_maxminddb
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
automake \
autoconf \
libtool \
g++ \
gcc \
make \
git \
curl \
apache2-dev \
; \
\
cd /tmp/; \
git clone --recursive https://github.com/maxmind/libmaxminddb.git; \
cd libmaxminddb/; \
./bootstrap; \
./configure; \
make; \
make check; \
make install; \
ldconfig /; \
\
cd /tmp/; \
git clone https://github.com/maxmind/mod_maxminddb.git; \
cd mod_maxminddb/; \
./bootstrap; \
./configure; \
make install; \
\
cd /tmp/; \
curl -O "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz";\
tar -zxf GeoLite2-City.tar.gz --strip 1; \
mkdir -p /opt/maxmind/; \
mv ./GeoLite2-City.mmdb /opt/maxmind/; \
\
apk del .build-deps; \
rm -rf /tmp/*
RUN mkdir -p /run/apache2/
COPY ./services/httpd/httpd-foreground /usr/local/bin/
EXPOSE 80
CMD ["httpd-foreground"]
Inserts wrong library path to httpd.conf
:
LoadModule negotiation_module modules/mod_negotiation.so
# Inserned line below
LoadModule maxminddb_module lib/apache2/mod_maxminddb.so
Produced error:
httpd_1 | httpd: Syntax error on line 168 of /etc/apache2/httpd.conf: Cannot load lib/apache2/mod_maxminddb.so into server: Error loading shared library /var/www/lib/apache2/mod_maxminddb.so: No such file or directory
As expected library was build to /var/www/modules/mod_maxminddb.so
in /var/www/modules -> /usr/lib/apache2
oschwald commented
I looked into this briefly and I believe this is actually a bug in the apxs
that ships with Alpine. We don't do any of this path manipulation ourselves and just call apxs -i -a -n maxminddb .libs/mod_maxminddb.so
, which installs the module and adds it to the configuration.
oschwald commented
Closing as I do not believe it is a bug in the repo.