change base image to Alpine

- change image to security patched Java Alpine;
- add Makefile and .env for easier build and release
pull/27/head
Adrian Lapierre 2023-07-18 12:27:20 +02:00
parent d151510c1e
commit bdd62dbfac
4 changed files with 29 additions and 24 deletions

3
.env 100644
View File

@ -0,0 +1,3 @@
IMAGE_VERSION=2.22.4
GS_VERSION=2.22.4
TOMCAT_VERSION=9.0.78

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04 as tomcat
FROM lapierre/java-alpine:11 as tomcat
ARG TOMCAT_VERSION=9.0.75
ARG CORS_ENABLED=false
@ -26,14 +26,6 @@ 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 \
@ -41,12 +33,11 @@ RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/b
&& 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
&& 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

11
Makefile 100644
View File

@ -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

View File

@ -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