Is your feature request related to a problem? Please describe.
The example Dockerfile sets `ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${TARGETARCH}` where `TARGETARCH` defaults to `amd64`. On arm64 k3d nodes (Apple Silicon), this path does not exist, causing `spark-submit` to fail immediately:
```
/usr/lib/jvm/java-11-openjdk-amd64/bin/java: No such file or directory
```
The Dockerfile already auto-detects the correct Java path at build time and writes it to `/etc/environment`:
```dockerfile
RUN JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) &&
echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
```
But this is immediately overridden by the subsequent `ENV JAVA_HOME=...` line. The current workaround is to source `/etc/environment` in `entrypoint.sh` before invoking `spark-submit`, but this is a bandaid — the root cause is the hardcoded arch in the `ENV` line.
Describe the solution you'd like
Remove the hardcoded `ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${TARGETARCH}` line from `examples/Dockerfile` and replace it with a single `RUN` step that auto-detects and exports `JAVA_HOME` for any architecture:
```dockerfile
RUN JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) &&
echo "export JAVA_HOME=${JAVA_HOME}" >> /etc/profile.d/java.sh &&
echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
ENV JAVA_HOME=""
```
Or use a Docker build arg with auto-detection that is evaluated at build time rather than as a static string.
Once this is fixed, the `entrypoint.sh` workaround (sourcing `/etc/environment`) can also be removed.
Describe alternatives you've considered
- Keep the `entrypoint.sh` workaround (current state) — works but is fragile and non-obvious
- Use `--build-arg TARGETARCH=arm64` explicitly — puts the burden on the caller
- Switch the base image to one where Java is already on `PATH` without `JAVA_HOME`
Additional context
Is your feature request related to a problem? Please describe.
The example Dockerfile sets `ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${TARGETARCH}` where `TARGETARCH` defaults to `amd64`. On arm64 k3d nodes (Apple Silicon), this path does not exist, causing `spark-submit` to fail immediately:
```
/usr/lib/jvm/java-11-openjdk-amd64/bin/java: No such file or directory
```
The Dockerfile already auto-detects the correct Java path at build time and writes it to `/etc/environment`:
```dockerfile$(dirname $ (readlink -f $(which java)))) &&
RUN JAVA_HOME=$(dirname
echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
```
But this is immediately overridden by the subsequent `ENV JAVA_HOME=...` line. The current workaround is to source `/etc/environment` in `entrypoint.sh` before invoking `spark-submit`, but this is a bandaid — the root cause is the hardcoded arch in the `ENV` line.
Describe the solution you'd like
Remove the hardcoded `ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${TARGETARCH}` line from `examples/Dockerfile` and replace it with a single `RUN` step that auto-detects and exports `JAVA_HOME` for any architecture:
```dockerfile$(dirname $ (readlink -f $(which java)))) &&
RUN JAVA_HOME=$(dirname
echo "export JAVA_HOME=${JAVA_HOME}" >> /etc/profile.d/java.sh &&
echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
ENV JAVA_HOME=""
```
Or use a Docker build arg with auto-detection that is evaluated at build time rather than as a static string.
Once this is fixed, the `entrypoint.sh` workaround (sourcing `/etc/environment`) can also be removed.
Describe alternatives you've considered
Additional context