Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about change base image to Alpine? #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IMAGE_VERSION=2.22.4
GS_VERSION=2.22.4
TOMCAT_VERSION=9.0.78
35 changes: 13 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as tomcat
FROM lapierre/java-alpine:11 as tomcat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use a Docker vetted "Official image"? instead of pushing your own JDK version (having a full JDK is total overkill)

Suggested change
FROM lapierre/java-alpine:11 as tomcat
FROM eclipse-temurin:11-jre-alpine as tomcat


ARG TOMCAT_VERSION=9.0.75
ARG CORS_ENABLED=false
Expand Down Expand Up @@ -26,27 +26,18 @@ ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS \
-Dsun.java2d.renderer=sun.java2d.marlin.DMarlinRenderingEngine \
-Dorg.geotools.coverage.jaiext.enabled=true"

# init
RUN apt update \
&& apt -y upgrade \
&& apt install -y --no-install-recommends openssl unzip gdal-bin wget curl openjdk-11-jdk \
&& apt clean \
&& rm -rf /var/cache/apt/* \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/

RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& tar xf apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& rm apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/ROOT \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/docs \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/examples
&& tar xf apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& rm apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/ROOT \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/docs \
&& rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/examples \
&& ln -s $CATALINA_HOME /opt/apache-tomcat

# cleanup
RUN apt purge -y \
&& apt autoremove --purge -y \
&& rm -rf /tmp/*
RUN rm -rf /tmp/*

FROM tomcat as download

Expand All @@ -59,10 +50,10 @@ ENV GEOSERVER_BUILD=$GS_BUILD
WORKDIR /tmp

RUN echo "Downloading GeoServer ${GS_VERSION} ${GS_BUILD}" \
&& wget -q -O /tmp/geoserver.zip $WAR_ZIP_URL \
&& unzip geoserver.zip geoserver.war -d /tmp/ \
&& unzip -q /tmp/geoserver.war -d /tmp/geoserver \
&& rm /tmp/geoserver.war
&& wget -q -O /tmp/geoserver.zip $WAR_ZIP_URL \
&& unzip geoserver.zip geoserver.war -d /tmp/ \
&& unzip -q /tmp/geoserver.war -d /tmp/geoserver \
&& rm /tmp/geoserver.war

FROM tomcat as install

Expand Down Expand Up @@ -98,7 +89,7 @@ RUN echo "Installing GeoServer $GS_VERSION $GS_BUILD"
COPY --from=download /tmp/geoserver $CATALINA_HOME/webapps/geoserver

RUN mv $CATALINA_HOME/webapps/geoserver/WEB-INF/lib/marlin-*.jar $CATALINA_HOME/lib/marlin.jar \
&& mkdir -p $GEOSERVER_DATA_DIR
&& mkdir -p $GEOSERVER_DATA_DIR

COPY $GS_DATA_PATH $GEOSERVER_DATA_DIR
COPY $ADDITIONAL_LIBS_PATH $GEOSERVER_LIB_DIR
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include .env

IMAGE_NAME=geoserver-docker.osgeo.org/geoserver

docker:
docker build --build-arg CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS --build-arg CORS_ENABLED=true --build-arg GS_VERSION=$(GS_VERSION) --build-arg TOMCAT_VERSION=$(TOMCAT_VERSION) --pull -t $(IMAGE_NAME):$(IMAGE_VERSION) .
docker tag $(IMAGE_NAME):$(IMAGE_VERSION) $(IMAGE_NAME):latest
push:
docker push $(IMAGE_NAME):$(IMAGE_VERSION)
docker push $(IMAGE_NAME):latest

4 changes: 2 additions & 2 deletions docker-compose-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ services:
build:
context: .
args:
- GEOSERVER_VERSION=2.22.0
- GEOSERVER_VERSION=${GS_VERSION}
- CORS_ENABLED=true
- CORS_ALLOWED_METHODS=GET,POST,PUT,HEAD,OPTIONS
ports:
- 80:8080
- "80:8080"
environment:
- INSTALL_EXTENSIONS=true
- STABLE_EXTENSIONS=wps,csw
Expand Down