Fork me on GitHub
#docker
<
2022-11-10
>
agorgl19:11:08

I'm trying to cross-build an arm64 image using podman with podman build -t sample:latest -f deploy/Containerfile . --arch=arm64. My cross building environment works in general but now at the uberjar step I get:

[1/4] STEP 4/4: RUN clojure -T:build uber :uber-file '"target/app.jar"' :resource-dirs '["config" "resources"]'
Cloning: 
Error building classpath. Cannot run program "git": error=0, Failed to exec spawn helper: pid: 66, exit value: 1
java.io.IOException: Cannot run program "git": error=0, Failed to exec spawn helper: pid: 66, exit value: 1
...
Any ideas?

lukasz19:11:52

your base image doesn't have git installed?

lukasz19:11:57

(never used podman btw)

agorgl19:11:40

base image is clojure:tools-deps and the whole Dockerfile works as expected when building for amd64

lukasz21:11:37

Not sure if it will work then - you need to use an arm64 image on your arm machine to build - that's why git executable doesn't work

agorgl20:11:20

I think I might be onto something about the arm64 images issue. Minimal POC: Using podman (or docker), run a vanilla tools:deps (amd64) image:

podman run --rm -it clojure:tools-deps
In the spawned clojure repl, enter:
(require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
On the amd64 variant it returns:
user=> (require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
nil
{:exit 0, :out "total 0\ndrwxrwxrwt 1 root root 30 Nov  7 20:52 .\ndr-xr-xr-x 1 root root 18 Nov 10 20:36 ..\ndrwxr-xr-x 1 root root  2 Nov 10 20:36 hsperfdata_root\n", :err ""}
Running an arm64 image using:
podman run --arch=arm64 --rm -it clojure:tools-deps
Entering the same expression, it returns:
(require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
nil
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
Execution error (IOException) at java.lang.ProcessImpl/forkAndExec (ProcessImpl.java:-2).
error=0, Failed to exec spawn helper: pid: 75, exit value: 1

lispyclouds21:11:37

I think @U06FS3DLH would know something about this.

cap10morgan21:11:39

hmm... not sure. my first thought is to make sure you run both of these commands since you're using a moving-target tag:

docker pull clojure:tools-deps
docker pull --platform=linux/amd64 clojure:tools-deps

cap10morgan21:11:11

(or --platform=linux/arm64 if your host is amd64)

agorgl21:11:10

I found it

agorgl21:11:19

Apparently it has to do something with this:

agorgl21:11:40

Changing image to clojure:temurin-11-tools-deps fixes the problem

👍 1