phntxx/dashboard

Can't run on Raspberry Pi 4B w/ Ubuntu Server 64-bit

leonbeon opened this issue · 6 comments

Hey, running this as a Docker container on a Raspberry Pi 4B with Ubuntu Server x64 outputs standard_init_linux.go:228: exec user process caused: exec format error to the logs. This seems to be a common error message for architecture mismatch. RPi4B runs on aarch64/arm64/v8. There seems to be no build for this arch for the ratisbonacoding/nginx-cloudflare-cache image this builds on (according to DockerHub). The nginxinc/nginx-unprivileged image the cloudflare container is depending on has builds for armv8 (DockerHub).

Could there be a version which is just straight up depending on nginx-unpriviliged, skipping the cloudflare-cache container? Thanks!

This is mine :) running on k3s on Raspberrypi 4

FROM phntxx/dashboard as builder
FROM nginxinc/nginx-unprivileged:alpine
COPY --from=builder /app /usr/share/nginx/html

With

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: dashboard
    app.kubernetes.io/part-of: dashboard
  name: dashboard
  namespace: dashboard
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: dashboard
      app.kubernetes.io/part-of: dashboard
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: dashboard
        app.kubernetes.io/part-of: dashboard
    spec:
      containers:
      - image: rg.fr-par.scw.cloud/cc2b5a5b-09f9-4378-afd3-badc4b2865ac/phntxx/dashboard:latest
        name: dashboard
        ports:
        - containerPort: 8080
          name: http
        resources:
          limits:
            cpu: 100m
            memory: 128Mi
          requests:
            cpu: 100m
            memory: 128Mi
        volumeMounts:
        - mountPath: /usr/share/nginx/html/data
          name: config
          readOnly: true
      restartPolicy: Always
      volumes:
      - configMap: # contains the JSON files, autogenerated with kustomize from a yaml file (more readable)
          name: config-562662tg42
        name: config

This is mine :) running on k3s on Raspberrypi 4

FROM phntxx/dashboard as builder
FROM nginxinc/nginx-unprivileged:alpine
COPY --from=builder /app /usr/share/nginx/html

Ah, so simple! Thanks!

I'd rather say "optimized" 😋

While I do like making this available out of the box, I struggle doing so.

I've managed getting multiarch images for ratisbonacoding/nginx-cloudflare-cache built yesterday.

The issue I'm facing lies within the fact that the node:lts image is used for building, followed by the ratisbonacoding/nginx-cloudflare-cache image, which is based on nginxinc/nginx-unprivileged:alpine.
If anyone here has expertise with docker buildx and knows how to help me out with the following, I'd really appreciate your input:

If we look at the Dockerfile for this project:

FROM node:lts AS build

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install

COPY . ./
RUN yarn build

FROM ratisbonacoding/nginx-cloudflare-cache
COPY --from=build /app/build /app
COPY nginx.conf /etc/nginx/nginx.conf

I'd like everything until RUN yarn build to run on one platform and everything after to be built for multiple architectures.

Hello. You can do this with this Dockerfile :) This will only be available throught docker buildx build.

-FROM node:lts AS build
+FROM --platform=$TARGETPLATFORM node:lts AS build

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install

COPY . ./
RUN yarn build

-FROM ratisbonacoding/nginx-cloudflare-cache
+FROM --platform=$TARGETPLATFORM ratisbonacoding/nginx-cloudflare-cache
COPY --from=build /app/build /app
COPY nginx.conf /etc/nginx/nginx.conf

Then. It should work

docker buildx create --name builder --use
docker buildx build --plateform linux/amd64,linux/arm/v7 --push --tag docker.io/phntxx/dashboard

EDIT: I think the --platform=$TARGETPLATFORM is optionnal here, you can try both

https://docs.docker.com/buildx/working-with-buildx/

I've recently discovered that my buildx configuration works, so there should now be an ARM image of this project available on Docker.

Closing.