Skip to content

Commit

Permalink
First refactoring of Docker base images
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy committed Oct 9, 2023
1 parent 90d9933 commit b3a84d1
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 1,120 deletions.
7 changes: 7 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ DOCKER_ENV=production
DOCKER_API_VERSION="1.24"
BACKUPS_VOLUME_DRIVER=local

GEONODE_BASE_IMAGE_VERSION="latest"
NGINX_BASE_IMAGE_VERSION="1.25.2"
LETSENCRYPT_BASE_IMAGE_VERSION=latest
GEOSERVER_BASE_IMAGE_VERSION="2.23.0"
GEOSERVER_DATA_BASE_IMAGE_VERSION="2.23.0"
POSTGRES_BASE_IMAGE_VERSION="15"

C_FORCE_ROOT=1
FORCE_REINIT=false
INVOKE_LOG_STDOUT=true
Expand Down
26 changes: 20 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ services:

# Gets and installs letsencrypt certificates
letsencrypt:
image: geonode/letsencrypt:latest
build: ./docker/letsencrypt/
build:
context: ./docker/letsencrypt
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${LETSENCRYPT_BASE_IMAGE_VERSION}
container_name: letsencrypt4${COMPOSE_PROJECT_NAME}
env_file:
- .env
Expand All @@ -95,8 +98,11 @@ services:

# Geoserver backend
geoserver:
image: geonode/geoserver:2.23.0
build: ./docker/geoserver/
build:
context: ./docker/geoserver
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEOSERVER_BASE_IMAGE_VERSION}
container_name: geoserver4${COMPOSE_PROJECT_NAME}
healthcheck:
test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://geoserver:8080/geoserver/ows"
Expand All @@ -122,7 +128,11 @@ services:
condition: service_healthy

data-dir-conf:
image: geonode/geoserver_data:2.23.0
build:
context: ./docker/geoserver_data
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${GEOSERVER_DATA_BASE_IMAGE_VERSION}
container_name: gsconf4${COMPOSE_PROJECT_NAME}
entrypoint: sleep infinity
volumes:
Expand All @@ -134,7 +144,11 @@ services:
# PostGIS database.
db:
# use geonode official postgis 15 image
image: geonode/postgis:15
build:
context: ./docker/postgresql
dockerfile: Dockerfile
args:
- BASE_IMAGE_VERSION=${POSTGRES_BASE_IMAGE_VERSION}
command: postgres -c "max_connections=${POSTGRESQL_MAX_CONNECTIONS}"
container_name: db4${COMPOSE_PROJECT_NAME}
env_file:
Expand Down
65 changes: 2 additions & 63 deletions docker/geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,2 @@
ARG IMAGE_VERSION=9.0-jdk11-openjdk-slim-bullseye
ARG JAVA_HOME=/usr/local/openjdk-11
FROM tomcat:$IMAGE_VERSION
LABEL GeoNode Development Team

ARG GEOSERVER_CORS_ENABLED=False
ARG GEOSERVER_CORS_ALLOWED_ORIGINS=*
ARG GEOSERVER_CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS
ARG GEOSERVER_CORS_ALLOWED_HEADERS=*
#
# Set GeoServer version and data directory
#
ENV GEOSERVER_VERSION=2.23.0
ENV GEOSERVER_DATA_DIR="/geoserver_data/data"
ENV GEOSERVER_CORS_ENABLED=$GEOSERVER_CORS_ENABLED
ENV GEOSERVER_CORS_ALLOWED_ORIGINS=$GEOSERVER_CORS_ALLOWED_ORIGINS
ENV GEOSERVER_CORS_ALLOWED_METHODS=$GEOSERVER_CORS_ALLOWED_METHODS
ENV GEOSERVER_CORS_ALLOWED_HEADERS=$GEOSERVER_CORS_ALLOWED_HEADERS
#
# Download and install GeoServer
#
RUN apt-get update -y && apt-get install curl wget unzip -y
RUN cd /usr/local/tomcat/webapps \
&& wget --no-check-certificate --progress=bar:force:noscroll https://artifacts.geonode.org/geoserver/${GEOSERVER_VERSION}/geoserver.war -O geoserver.war \
&& unzip -q geoserver.war -d geoserver \
&& rm geoserver.war \
&& mkdir -p $GEOSERVER_DATA_DIR

VOLUME $GEOSERVER_DATA_DIR

# added by simonelanucara https://github.com/simonelanucara
# Optionally add JAI, ImageIO and Marlin Render for improved Geoserver performance
WORKDIR /tmp

RUN wget --no-check-certificate https://repo1.maven.org/maven2/org/postgis/postgis-jdbc/1.3.3/postgis-jdbc-1.3.3.jar -O postgis-jdbc-1.3.3.jar && \
wget --no-check-certificate https://maven.geo-solutions.it/org/hibernatespatial/hibernate-spatial-postgis/1.1.3.2/hibernate-spatial-postgis-1.1.3.2.jar -O hibernate-spatial-postgis-1.1.3.2.jar && \
rm /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/hibernate-spatial-h2-geodb-1.1.3.2.jar && \
mv hibernate-spatial-postgis-1.1.3.2.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/ && \
mv postgis-jdbc-1.3.3.jar /usr/local/tomcat/webapps/geoserver/WEB-INF/lib/


# copy the script and perform the run of scripts from entrypoint.sh
RUN mkdir -p /usr/local/tomcat/tmp
WORKDIR /usr/local/tomcat/tmp
COPY set_geoserver_auth.sh /usr/local/tomcat/tmp
COPY entrypoint.sh /usr/local/tomcat/tmp
COPY tasks.py /usr/local/tomcat/tmp
COPY ./templates /templates
COPY multidump.sh /usr/local/tomcat/tmp
COPY multidump-alt.sh /usr/local/tomcat/tmp

RUN chmod +x /usr/local/tomcat/tmp/set_geoserver_auth.sh \
&& chmod +x /usr/local/tomcat/tmp/entrypoint.sh

RUN apt-get update \
&& apt-get install -y procps less \
&& apt-get install -y python3 python3-pip python3-dev

RUN pip install j2cli invoke==2.2.0 requests==2.31.0

ENV JAVA_OPTS="-Djava.awt.headless=true -Dgwc.context.suffix=gwc -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jvm.log -XX:MaxPermSize=512m -XX:PermSize=256m -Xms512m -Xmx2048m -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=4 -Dfile.encoding=UTF8 -Djavax.servlet.request.encoding=UTF-8 -Djavax.servlet.response.encoding=UTF-8 -Duser.timezone=GMT -Dorg.geotools.shapefile.datetime=false -DGS-SHAPEFILE-CHARSET=UTF-8 -DGEOSERVER_CSRF_DISABLED=true -DPRINT_BASE_URL=http://geoserver:8080/geoserver/pdf -Xbootclasspath/a:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/marlin-0.9.3.jar -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine"

CMD ["/usr/local/tomcat/tmp/entrypoint.sh"]
ARG BASE_IMAGE_VERSION
FROM geonode/geoserver:${BASE_IMAGE_VERSION}
128 changes: 0 additions & 128 deletions docker/geoserver/README.md

This file was deleted.

53 changes: 0 additions & 53 deletions docker/geoserver/docker-compose.yml

This file was deleted.

0 comments on commit b3a84d1

Please sign in to comment.