Skip to content

Commit

Permalink
test: use Ubuntu base image only
Browse files Browse the repository at this point in the history
Use the same Ubuntu base image to provide shell to avoid binary
incompatibility.
  • Loading branch information
vpa1977 committed Sep 17, 2024
1 parent c6b35df commit c437fe4
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions tests/containers/maven/Dockerfile.22.04
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
ARG UBUNTU_RELEASE=22.04
ARG BASE_IMAGE=ubuntu/jre:8_edge
ARG MAVEN_IMAGE=maven:3.9.6-eclipse-temurin-8
FROM $MAVEN_IMAGE as builder
ARG CHISEL_VERSION=0.10.0
ARG TARGETARCH=amd64

FROM public.ecr.aws/ubuntu/ubuntu:$UBUNTU_RELEASE@sha256:1582c29f34a48752e406f1a261fe9545fad895da3f6bb4be55bc82485557564e AS jdk

ARG CHISEL_VERSION
ARG TARGETARCH

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates \
ca-certificates-java \
binutils \
openjdk-8-jdk \
maven \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

SHELL ["/bin/bash", "-oeux", "pipefail", "-c"]
ADD https://github.com/canonical/chisel/releases/download/v${CHISEL_VERSION}/chisel_v${CHISEL_VERSION}_linux_${TARGETARCH}.tar.gz chisel.tar.gz
RUN tar -xvf chisel.tar.gz -C /usr/bin/
RUN mkdir -p /rootfs \
&& chisel cut --root /rootfs coreutils_bins dash_bins

FROM $BASE_IMAGE

COPY --from=builder /bin/sh /bin/sh
COPY --from=builder /usr/bin/chmod /usr/bin/chmod
COPY --from=builder /usr/bin/uname /usr/bin/uname
COPY --from=builder /usr/bin/dirname /usr/bin/dirname
# note, Temurin base does not install into /etc/maven and /usr/share/java
# other base might require copying those folders
COPY --from=builder /usr/share/maven /usr/share/maven
COPY --from=jdk /rootfs /
COPY --from=jdk /etc/maven /etc/maven
COPY --from=jdk /usr/share/java /usr/share/java
COPY --from=jdk /usr/share/maven /usr/share/maven

ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre

Expand Down

0 comments on commit c437fe4

Please sign in to comment.