From 9fff705f79f8ca96a4ee14f7e8b760ab3451291f Mon Sep 17 00:00:00 2001 From: madelen-at-work Date: Sat, 13 Apr 2024 13:29:58 +0200 Subject: [PATCH] Refactoring Dockerfile --- .github/workflows/cd.yml | 2 +- .gitignore | 1 + Dockerfile | 49 ++++++++++++++++++++++++++-------------- README.md | 2 +- build.sh | 2 +- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c779de63..13b15baa 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -83,7 +83,7 @@ jobs: dockerfile: Dockerfile tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ACAPARCH=${{ matrix.arch }} + build-args: ARCH=${{ matrix.arch }} outputs: "type=local,dest=build" - name: Get name of EAP-file id: get_eap_file_name diff --git a/.gitignore b/.gitignore index ab7da8fb..1515c8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build*/ +tls/ tmp/ dockerd docker-proxy diff --git a/Dockerfile b/Dockerfile index 4c7f63a3..6629d533 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,20 @@ # syntax=docker/dockerfile:1 ARG DOCKER_IMAGE_VERSION=26.0.0 +ARG PROCPS_VERSION=v3.3.17 ARG REPO=axisecp -ARG ACAPARCH=armv7hf +ARG ARCH=armv7hf ARG VERSION=1.13 ARG UBUNTU_VERSION=22.04 ARG NATIVE_SDK=acap-native-sdk -FROM ${REPO}/${NATIVE_SDK}:${VERSION}-${ACAPARCH}-ubuntu${UBUNTU_VERSION} as build_image +FROM ${REPO}/${NATIVE_SDK}:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION} AS sdk_image -FROM build_image AS ps -ARG PROCPS_VERSION=v3.3.17 -ARG BUILD_DIR=/build -ARG EXPORT_DIR=/export +FROM sdk_image AS build_image +# hadolint ignore=DL3009 RUN <$BUILD_CACHE \ - && echo ac_cv_func_malloc_0_nonnull=yes >>$BUILD_CACHE +RUN <$BUILD_CACHE + echo ac_cv_func_malloc_0_nonnull=yes >>$BUILD_CACHE +EOF + RUN < --build-arg ACAPARCH= --output . +docker buildx build --file Dockerfile --tag docker-acap: --build-arg ARCH= --output . ``` where `` is either `armv7hf` or `aarch64`. `` is the path to an output folder diff --git a/build.sh b/build.sh index 128b13cf..810c136a 100755 --- a/build.sh +++ b/build.sh @@ -40,7 +40,7 @@ done # Build and copy out the acap # shellcheck disable=SC2086 -docker buildx build --build-arg ACAPARCH="$arch" \ +docker buildx build --build-arg ARCH="$arch" \ --build-arg HTTP_PROXY="${HTTP_PROXY:-}" \ --build-arg HTTPS_PROXY="${HTTPS_PROXY:-}" \ --file Dockerfile \