forked from kartoza/docker-geoserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·123 lines (99 loc) · 5.01 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
ARG IMAGE_VERSION=9.0.89-jdk11-temurin-focal
ARG JAVA_HOME=/opt/java/openjdk
##############################################################################
# Plugin downloader #
##############################################################################
# This container pulls in lists of plugins from
# build_data/{required,stable,community}_plugins.txt, and then builds a curl
# configuration file to fetch everything in each list, allowing HTTPS
# connection re-use.
#
# By comparison, calling curl for each URL individually means setting up a new
# HTTPS connection for each URL, which is at least 3 network round-trips
# before we've even sent our HTTP request!
#
# Being a separate stage, docker buildx can run this part in parallel with the
# rest of the build, and it can leverage caches to improve re-build times when
# not changing any plugins (saving ~460 MiB of downloads).
# Use $BUILDPLATFORM because plugin archives are architecture-neutral, and use
# alpine because it's smaller.
FROM --platform=$BUILDPLATFORM alpine:3.19 AS geoserver-plugin-downloader
ARG GS_VERSION=2.25.1
ARG STABLE_PLUGIN_BASE_URL=https://sourceforge.net/projects/geoserver/files/GeoServer
RUN apk update && apk add curl
WORKDIR /work
ADD \
build_data/required_plugins.txt \
build_data/stable_plugins.txt \
build_data/community_plugins.txt \
build_data/plugin_download.sh \
/work/
RUN /work/plugin_download.sh
##############################################################################
# Production stage #
##############################################################################
FROM tomcat:$IMAGE_VERSION AS geoserver-prod
LABEL maintainer="Tim Sutton<tim@linfiniti.com>"
ARG GS_VERSION=2.25.0
ARG WAR_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip
ARG STABLE_PLUGIN_BASE_URL=https://sourceforge.net/projects/geoserver/files/GeoServer
ARG HTTPS_PORT=8443
ENV DEBIAN_FRONTEND=noninteractive
#Install extra fonts to use with sld font markers
RUN set -eux; \
apt-get update; \
apt-get -y --no-install-recommends install \
locales gnupg2 ca-certificates software-properties-common iputils-ping \
apt-transport-https gettext fonts-cantarell fonts-liberation lmodern ttf-aenigma \
ttf-bitstream-vera ttf-sjfonts tv-fonts libapr1-dev libssl-dev git \
zip unzip curl xsltproc certbot cabextract gettext postgresql-client figlet gosu gdal-bin libgdal-java; \
dpkg-divert --local --rename --add /sbin/initctl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true
ENV \
JAVA_HOME=${JAVA_HOME} \
DEBIAN_FRONTEND=noninteractive \
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir \
GDAL_DATA=/usr/share/gdal \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/tomcat/native-jni-lib:/usr/lib/jni:/usr/local/apr/lib:/opt/libjpeg-turbo/lib64:/usr/lib:/usr/lib/x86_64-linux-gnu" \
FOOTPRINTS_DATA_DIR=/opt/footprints_dir \
GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc \
CERT_DIR=/etc/certs \
RANDFILE=/etc/certs/.rnd \
FONTS_DIR=/opt/fonts \
GEOSERVER_HOME=/geoserver \
EXTRA_CONFIG_DIR=/settings \
COMMUNITY_PLUGINS_DIR=/community_plugins \
STABLE_PLUGINS_DIR=/stable_plugins \
REQUIRED_PLUGINS_DIR=/required_plugins
WORKDIR /scripts
ADD resources /tmp/resources
ADD build_data /build_data
ADD scripts /scripts
COPY --from=geoserver-plugin-downloader /work/required_plugins/*.zip ${REQUIRED_PLUGINS_DIR}/
COPY --from=geoserver-plugin-downloader /work/required_plugins.txt ${REQUIRED_PLUGINS_DIR}/
COPY --from=geoserver-plugin-downloader /work/stable_plugins/*.zip ${STABLE_PLUGINS_DIR}/
COPY --from=geoserver-plugin-downloader /work/community_plugins/*.zip ${COMMUNITY_PLUGINS_DIR}/
RUN echo $GS_VERSION > /scripts/geoserver_version.txt && echo $STABLE_PLUGIN_BASE_URL > /scripts/geoserver_gs_url.txt ;\
chmod +x /scripts/*.sh;/scripts/setup.sh \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE $HTTPS_PORT
RUN echo 'figlet -t "Kartoza Docker GeoServer"' >> ~/.bashrc
WORKDIR ${GEOSERVER_HOME}
ENTRYPOINT ["/bin/bash", "/scripts/entrypoint.sh"]
##############################################################################
# Testing Stage #
##############################################################################
FROM geoserver-prod AS geoserver-test
COPY ./scenario_tests/utils/requirements.txt /lib/utils/requirements.txt
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get -y --no-install-recommends install python3-pip procps \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install -r /lib/utils/requirements.txt;pip3 install numpy --upgrade