diff --git a/Dockerfile b/Dockerfile index b69caaf..fec8864 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,15 @@ # if build-arg VERSION is empty, then version is ignored # if build-arg BRANCH is empty then defaults to develop +FROM debian:stretch-slim AS uptodate-stretch-slim + +# Must use archive for Debian Stretch packages +RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] +RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] +RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] # Use latest JDK 8 in Debian Stretch (which is the base of gcr.io/distroless/java:8) -FROM debian:stretch-slim AS builder +FROM uptodate-stretch-slim AS builder # Provide docker images for each commit @@ -38,11 +44,6 @@ ENV EXIST_MAX "/usr/local/exist" # Install tools required to build eXist-db WORKDIR /usr/local -# Must use archive for Debian Stretch packages -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] - RUN apt-get update && apt-get -y install apt-utils && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends \ openjdk-8-jdk-headless \ xmlstarlet \ @@ -159,12 +160,7 @@ RUN echo 'modifying conf files'\ # COPY ./src/log4j2.xml $EXIST_MIN/config # Installl latest JRE 8 in Debian Stretch (which is the base of gcr.io/distroless/java:8) -FROM debian:stretch-slim AS updated-jre - -# Must use archive for Debian Stretch packages -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] +FROM uptodate-stretch-slim AS updated-jre RUN apt-get update && apt-get -y install apt-utils && apt-get -y dist-upgrade RUN apt-get install -y openjdk-8-jre-headless diff --git a/Dockerfile-DEBUG b/Dockerfile-DEBUG index 17cd514..05133c8 100644 --- a/Dockerfile-DEBUG +++ b/Dockerfile-DEBUG @@ -24,8 +24,15 @@ # if build-arg BRANCH is empty then defaults to develop +FROM debian:stretch-slim AS uptodate-stretch-slim + +# Must use archive for Debian Stretch packages +RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] +RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] +RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] + # Use latest JDK 8 in Debian Stretch (which is the base of gcr.io/distroless/java:8) -FROM debian:stretch-slim AS builder +FROM uptodate-stretch-slim AS builder # Provide docker images for each commit @@ -38,11 +45,6 @@ ENV EXIST_MAX "/usr/local/exist" # Install tools required to build eXist-db WORKDIR /usr/local -# Must use archive for Debian Stretch packages -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] - RUN apt-get update && apt-get -y install apt-utils && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends \ openjdk-8-jdk-headless \ xmlstarlet \ @@ -159,12 +161,7 @@ RUN echo 'modifying conf files'\ # COPY ./src/log4j2.xml $EXIST_MIN/config # Use JDK 8 in Debian Stretch (as our production image gcr.io/distroless/java:8 is based on Debian Stretch with just a JRE) -FROM debian:stretch-slim - -# Must use archive for Debian Stretch packages -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch main%deb http://archive.debian.org/debian stretch main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%deb http://deb.debian.org/debian stretch-updates main%#deb http://deb.debian.org/debian stretch-updates main%g", "/etc/apt/sources.list"] -RUN ["sed", "-i", "s%security.debian.org%archive.debian.org%g", "/etc/apt/sources.list"] +FROM uptodate-stretch-slim RUN apt-get update && apt-get -y install apt-utils && apt-get -y dist-upgrade RUN apt-get install -y openjdk-8-jdk-headless