Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: fix build on arm64 architecture #363

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

tiborsimko
Copy link
Member

@tiborsimko tiborsimko force-pushed the docker-arm64 branch 2 times, most recently from b67cc8c to 6f5b00d Compare October 31, 2023 14:43
Dockerfile Outdated
@@ -1,11 +1,31 @@
# Use Node 18
FROM docker.io/library/node:18 as react-build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Disclaimer: I have not tested this)

For reana-ui we are using a multi-stage build, where the first stage builds all the static files (js, css, etc.) while the second stage is just a simple nginx server that serves these static assets. These assets do not depend on the architecture, as they are just JS/CSS sources/images.

In this case we should be able to run the first stage always in the native architecture of the builder and after that run the second stage in the target architecture (possibly emulated), as explained here: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/

This does not bring advantages when the build architecture and the target architecture are the same, but it should make cross-building faster

As far as I can tell, it's only necessary to change this first line:

Suggested change
FROM docker.io/library/node:18 as react-build
FROM --platform=$BUILDPLATFORM docker.io/library/node:18 as react-build

Copy link
Member Author

@tiborsimko tiborsimko Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can test it this evening.

Dockerfile Outdated
libjpeg-dev \
libpango1.0-dev \
librsvg2-dev && \
cd reana-ui && \
yarn && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally I see some network timeouts, probably due to emulation slowness. This fixes it:

Suggested change
yarn && \
yarn --network-timeout 600000 && \

@tiborsimko tiborsimko merged commit 9da1288 into reanahub:master Nov 1, 2023
8 checks passed
@tiborsimko tiborsimko deleted the docker-arm64 branch November 1, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker: build and publish ARM images
2 participants