From 9da1288f166922586a9a071fa28fcca162b172ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Sun, 29 Oct 2023 17:47:06 +0100 Subject: [PATCH] docker: fix build on arm64 architecture Closes reanahub/reana#753. --- CHANGES.rst | 1 + Dockerfile | 31 ++++++++++++++++++++++++++----- run-tests.sh | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d51e7c70..8bdfb41e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ Version 0.9.2 (UNRELEASED) - Adds option to delete all the runs of a workflow. - Changes Docker image Node version from 16 to 18. +- Fixes container image building on the arm64 architecture. Version 0.9.1 (2023-09-27) -------------------------- diff --git a/Dockerfile b/Dockerfile index 4cf6ccd6..e6e66b46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,32 @@ -FROM docker.io/library/node:18 as react-build +# Use Node 18 +# hadolint ignore=DL3029 +FROM --platform=$BUILDPLATFORM docker.io/library/node:18 as react-build + +# Use default answers in installation commands +ENV DEBIAN_FRONTEND=noninteractive + +# Copy cluster component source code WORKDIR /code COPY . /code -# hadolint ignore=DL3003 -RUN cd reana-ui && \ - yarn && \ - yarn build +# Build frontend application +# hadolint ignore=DL3003,DL3008 +RUN apt-get update -y && \ + apt-get install --no-install-recommends -y \ + build-essential \ + libcairo2-dev \ + libgif-dev \ + libjpeg-dev \ + libpango1.0-dev \ + librsvg2-dev && \ + cd reana-ui && \ + yarn --network-timeout 600000 && \ + yarn build && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Serve frontend application FROM docker.io/library/nginx:1.19 COPY --from=react-build /code/reana-ui/build /usr/share/nginx/html COPY nginx/reana-ui.conf /etc/nginx/conf.d/default.conf diff --git a/run-tests.sh b/run-tests.sh index 82371df6..f1760198 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -33,7 +33,7 @@ check_js_tests () { } check_dockerfile () { - docker run -i --rm docker.io/hadolint/hadolint:v1.18.2 < Dockerfile + docker run -i --rm docker.io/hadolint/hadolint:v2.12.0 < Dockerfile } check_docker_build () {