Skip to content

Commit

Permalink
Use common build stage for updated Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Oct 16, 2024
1 parent 7b13ebc commit 9ff4e63
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
21 changes: 9 additions & 12 deletions Dockerfile-DEBUG
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ff4e63

Please sign in to comment.