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

Dockerfile does not build with arm64 arch #201

Open
libremente opened this issue Sep 10, 2024 · 1 comment
Open

Dockerfile does not build with arm64 arch #201

libremente opened this issue Sep 10, 2024 · 1 comment

Comments

@libremente
Copy link
Member

The current docker image is not compatible with arm64 and the Dockerfile does not build on that same arch.
I believe it could be nice to have a multi-platform version to easily run the image also on ARM arch.

I had to switch to the following configuration to make it build:

diff --git a/Dockerfile b/Dockerfile
index f5f2251..1344eaf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,9 +4,9 @@
 #

 # Accept the Go version for the image to be set as a build argument.
-ARG GO_VERSION=1.18-alpine
+ARG GO_VERSION=1.23-alpine

-FROM docker.io/golang:${GO_VERSION} as build
+FROM arm64v8/golang:${GO_VERSION} as build

 WORKDIR /go/src

@@ -14,7 +14,7 @@ COPY . .

 RUN cd publiccode-parser && go build -ldflags="-s -w"

-FROM docker.io/alpine:3
+FROM arm64v8/alpine:3

LMK if you want a PR for a multi-platform build (maybe also via GHA?) or it's a non-issue for you.
Thanks!

@bfabio
Copy link
Member

bfabio commented Oct 24, 2024

Dockerfile was meant just for development, as in having a recent enough go compiler.

I'm wondering if we even need it still, given even Debian stable has a backport of go 1.21 (which is the min version anyway, not 1.18 as you correctly spotted).
Even if it didn't, the development environment is just a docker run -it golang away plus go build inside it.

I'd go ahead and remove it.

If you were trying to just run the parser on arm64 instead of developing, we have precompiled binaries here:
https://github.com/italia/publiccode-parser-go/releases

On the other hand, an arm64 version of the image on Dockerhub is a good idea, in that case the relevant files are Dockerfile.goreleaser and .goreleaser.yml, that's the way we generate the production images.

We need to take a look at this https://goreleaser.com/cookbooks/multi-platform-docker-images/, I personally am not really familiar with the process but it looks feasible.

So:

  1. Trash Dockerfile
  2. Make a multiplatform Docker image or/and multiple images for other platforms

wdyt?

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

No branches or pull requests

2 participants