-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (56 loc) · 2.24 KB
/
Dockerfile
File metadata and controls
70 lines (56 loc) · 2.24 KB
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
67
68
69
70
FROM ubuntu:24.04
LABEL maintainer="datapunt@amsterdam.nl"
ARG DEBIAN_FRONTEND=noninteractive
# build-time inputs
ARG EXTRA_ARG1
ARG EXTRA_ARG2
ENV MAP_URL="${EXTRA_ARG1:-http://localhost:8383}" \
LEGEND_URL="${EXTRA_ARG2:-http://localhost:8383}"
# echo domain variables used
RUN echo "Using ARGS=$EXTRA_ARG1 LEGEND_URL=$EXTRA_ARG2"
RUN echo "Using MAP_URL=$MAP_URL LEGEND_URL=$LEGEND_URL"
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
apache2 \
cgi-mapserver \
curl \
gdal-bin \
gdal-data \
mapserver-bin \
python3-pip \
wget \
&& apt-get clean
# Enable these Apache modules
RUN a2enmod actions cgid headers rewrite
# rm default access log
RUN a2disconf other-vhosts-access-log
# Configure localhost in Apache
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN sed -i '/^Listen 80$/d' /etc/apache2/ports.conf
#config file
COPY mapserver.conf /usr/local/etc/
RUN echo "SetEnv MAPSERVER_CONFIG_FILE \"/usr/local/etc/mapserver.conf\"" >> /etc/apache2/apache2.conf
# apache config
RUN rm /etc/apache2/mods-enabled/alias.conf
COPY docker/conf/custom.conf /etc/apache2/conf-enabled/
COPY docker/conf/ports.conf /etc/apache2/ports.conf
COPY docker/000-default.conf /etc/apache2/sites-available/
COPY docker/docker-entrypoint.sh /bin
COPY epsg /usr/share/proj
# set apache user id matching ctr user id
RUN usermod --non-unique --uid 999 www-data
RUN groupmod -o -g 999 www-data
RUN mkdir /var/lock/apache2 && mkdir /var/run/apache2
RUN chown -R 999:999 /var/lock/apache2 && chown -R 999:999 /var/run/apache2 && chown -R 999:999 /var/log/apache2/
RUN chown -R 999:999 /srv/ && chown -R 999:999 /etc/apache2/
# maps
COPY --chown=999:999 . /srv/mapserver/
RUN for i in /srv/mapserver/*.map; do echo $i; done
RUN : "${MAP_URL:?MAP_URL not set}" \
&& : "${LEGEND_URL:?LEGEND_URL not set}" \
&& find /srv/mapserver /srv/mapserver/referentiekaarten -maxdepth 1 -type f -name "*.map" -exec sed -i -e "s#MAP_URL_REPLACE#${MAP_URL}#g" -e "s#LEGEND_URL_REPLACE#${LEGEND_URL}#g" {} +
RUN rm -rf /srv/mapserver/private
RUN python3 /srv/mapserver/tools/make_indexjson.py /srv/mapserver/*.map > /srv/mapserver/index.json
EXPOSE 8080
USER www-data
CMD /bin/docker-entrypoint.sh