From 715c6292c78cf9d7fe947276ae1672263cc821b0 Mon Sep 17 00:00:00 2001 From: Johann Christensen Date: Thu, 24 Feb 2022 09:27:37 +0100 Subject: [PATCH] Create a single Dockerfile for both the UDM-Pro and UDM-SE The new Dockerfile will work for both the UDM-Pro and UDM-SE. It takes in a build-arg specifying the UDM-PLATFORM. As the only real difference between the builds was the patch file, it will load the correct file depending on the platform. --- podman-update/build/Dockerfile | 71 ++++++++++++++----- podman-update/build/Dockerfile.Se | 39 ---------- ...le.patch => podman.Makefile.UDM-Pro.patch} | 0 ....se.patch => podman.Makefile.UDM-SE.patch} | 0 4 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 podman-update/build/Dockerfile.Se rename podman-update/build/{podman.Makefile.patch => podman.Makefile.UDM-Pro.patch} (100%) rename podman-update/build/{podman.Makefile.se.patch => podman.Makefile.UDM-SE.patch} (100%) diff --git a/podman-update/build/Dockerfile b/podman-update/build/Dockerfile index c8a8b30..ee0b5ad 100644 --- a/podman-update/build/Dockerfile +++ b/podman-update/build/Dockerfile @@ -1,40 +1,79 @@ FROM golang:1.16-stretch +# Currenrtly supported versions: UDM-Pro, UDM-SE +ARG UDM_PLATFORM=UDM-Pro -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y zip git pkg-config libc6-arm64-cross libc6-dev-arm64-cross binutils-aarch64-linux-gnu libncurses5-dev build-essential bison flex libssl-dev bc gcc-aarch64-linux-gnu -RUN dpkg --add-architecture arm64 && apt-get update && apt-get install -y libseccomp-dev:arm64 libglib2.0-dev:arm64 gperf:arm64 ARG PODMAN_VERSION=v3.4.4 ARG RUNC_VERSION=v1.1.0 ARG CONMON_VERSION=v2.1.0 +ARG DEBIAN_FRONTEND=noninteractive + +# Install dependencies +RUN apt-get update && apt-get install -y \ + bc \ + binutils-aarch64-linux-gnu \ + bison \ + build-essential \ + flex \ + gcc-aarch64-linux-gnu \ + git \ + libc6-arm64-cross \ + libc6-dev-arm64-cross \ + libncurses5-dev \ + libssl-dev \ + pkg-config \ + systemd \ + zip \ + && rm -rf /var/lib/apt/lists/* +RUN dpkg --add-architecture arm64 +RUN apt-get update && apt-get install -y \ + gperf:arm64 \ + libglib2.0-dev:arm64 \ + libseccomp-dev:arm64 \ + libsystemd-dev:arm64 \ + && rm -rf /var/lib/apt/lists/* + ENV GOOS=linux -COPY ./podman.Makefile.patch /tmp -COPY ./runc.Makefile.patch /tmp -RUN mkdir -p /build && mkdir -p /tmp/release +COPY ./podman.Makefile.${UDM_PLATFORM}.patch /tmp +RUN mkdir -p /build \ + && mkdir -p /tmp/release WORKDIR /build -RUN git clone https://github.com/containers/podman && git clone https://github.com/opencontainers/runc && git clone https://github.com/containers/conmon +RUN git clone https://github.com/containers/podman.git \ + && git clone https://github.com/opencontainers/runc.git \ + && git clone https://github.com/containers/conmon.git WORKDIR /build/runc -RUN git checkout $RUNC_VERSION && ./script/release_build.sh -a arm64 -r /tmp/release +RUN git checkout ${RUNC_VERSION} \ + && ./script/release_build.sh -a arm64 -r /tmp/release ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/ ENV GOARCH=arm64 ENV CC='aarch64-linux-gnu-gcc' WORKDIR /build/podman -RUN git checkout $PODMAN_VERSION && patch Makefile /tmp/podman.Makefile.patch && make vendor local-cross && \ - cp ./bin/podman.cross.linux.arm64 /tmp/release/podman-$PODMAN_VERSION && chmod +x /tmp/release/podman-$PODMAN_VERSION - +RUN git checkout ${PODMAN_VERSION} \ + && patch Makefile /tmp/podman.Makefile.${UDM_PLATFORM}.patch \ + && make vendor local-cross \ + && cp ./bin/podman.cross.linux.arm64 /tmp/release/podman-${PODMAN_VERSION} \ + && chmod +x /tmp/release/podman-${PODMAN_VERSION} WORKDIR /build/conmon -RUN git checkout $CONMON_VERSION && make vendor bin/conmon && cp bin/conmon /tmp/release/conmon-$CONMON_VERSION && chmod +x /tmp/release/conmon-$CONMON_VERSION +RUN git checkout ${CONMON_VERSION} \ + && make vendor bin/conmon \ + && cp bin/conmon /tmp/release/conmon-${CONMON_VERSION} \ + && chmod +x /tmp/release/conmon-$CONMON_VERSION -RUN mkdir -p /tmp/install/usr/bin && mkdir -p /tmp/install/usr/libexec/podman/ && mkdir -p /tmp/install/usr/share/containers/ && mkdir -p /tmp/install/etc/containers/ +RUN mkdir -p /tmp/install/usr/bin \ + && mkdir -p /tmp/install/usr/libexec/podman/ \ + && mkdir -p /tmp/install/usr/share/containers/ \ + && mkdir -p /tmp/install/etc/containers/ COPY seccomp.json /tmp/install/usr/share/containers/ COPY containers.conf /tmp/install/etc/containers/ -RUN cp /tmp/release/podman-$PODMAN_VERSION /tmp/install/usr/bin/podman && cp /tmp/release/runc.arm64 /tmp/install/usr/bin/runc && cp /tmp/release/conmon-$CONMON_VERSION /tmp/install/usr/libexec/podman/conmon +RUN cp /tmp/release/podman-${PODMAN_VERSION} /tmp/install/usr/bin/podman \ + && cp /tmp/release/runc.arm64 /tmp/install/usr/bin/runc \ + && cp /tmp/release/conmon-${CONMON_VERSION} /tmp/install/usr/libexec/podman/conmon WORKDIR /tmp/install + +# Zip up the files RUN zip -r /tmp/release/podman-install.zip * - - diff --git a/podman-update/build/Dockerfile.Se b/podman-update/build/Dockerfile.Se deleted file mode 100644 index e6414c4..0000000 --- a/podman-update/build/Dockerfile.Se +++ /dev/null @@ -1,39 +0,0 @@ -FROM golang:1.16-stretch - -# Run build - -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y systemd zip git pkg-config libc6-arm64-cross libc6-dev-arm64-cross binutils-aarch64-linux-gnu libncurses5-dev build-essential bison flex libssl-dev bc gcc-aarch64-linux-gnu -RUN dpkg --add-architecture arm64 && apt-get update && apt-get install -y libseccomp-dev:arm64 && apt-get install -y libglib2.0-dev:arm64 && apt-get install -y libsystemd-dev:arm64 -ARG PODMAN_VERSION=v3.4.4 -ARG RUNC_VERSION=v1.1.0 -ARG CONMON_VERSION=v2.1.0 - -ENV GOOS=linux - -COPY ./podman.Makefile.se.patch /tmp -RUN mkdir -p /build && mkdir -p /tmp/release -WORKDIR /build -RUN git clone https://github.com/containers/podman && git clone https://github.com/opencontainers/runc && git clone https://github.com/containers/conmon -WORKDIR /build/runc - -RUN git checkout $RUNC_VERSION && ./script/release_build.sh -a arm64 -r /tmp/release -ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/ -ENV GOARCH=arm64 -ENV CC='aarch64-linux-gnu-gcc' -WORKDIR /build/podman -RUN git checkout $PODMAN_VERSION && patch Makefile /tmp/podman.Makefile.patch && make vendor local-cross && \ - cp ./bin/podman.cross.linux.arm64 /tmp/release/podman-$PODMAN_VERSION && chmod +x /tmp/release/podman-$PODMAN_VERSION - - -WORKDIR /build/conmon -RUN git checkout $CONMON_VERSION && make vendor bin/conmon && cp bin/conmon /tmp/release/conmon-$CONMON_VERSION && chmod +x /tmp/release/conmon-$CONMON_VERSION - -RUN mkdir -p /tmp/install/usr/bin && mkdir -p /tmp/install/usr/libexec/podman/ && mkdir -p /tmp/install/usr/share/containers/ && mkdir -p /tmp/install/etc/containers/ -COPY seccomp.json /tmp/install/usr/share/containers/ -COPY containers.conf /tmp/install/etc/containers/ -RUN cp /tmp/release/podman-$PODMAN_VERSION /tmp/install/usr/bin/podman && cp /tmp/release/runc.arm64 /tmp/install/usr/bin/runc && cp /tmp/release/conmon-$CONMON_VERSION /tmp/install/usr/libexec/podman/conmon -WORKDIR /tmp/install -RUN zip -r /tmp/release/podman-install.zip * - - diff --git a/podman-update/build/podman.Makefile.patch b/podman-update/build/podman.Makefile.UDM-Pro.patch similarity index 100% rename from podman-update/build/podman.Makefile.patch rename to podman-update/build/podman.Makefile.UDM-Pro.patch diff --git a/podman-update/build/podman.Makefile.se.patch b/podman-update/build/podman.Makefile.UDM-SE.patch similarity index 100% rename from podman-update/build/podman.Makefile.se.patch rename to podman-update/build/podman.Makefile.UDM-SE.patch