nats-io / nats-docker

Official Docker image for the NATS server
Apache License 2.0
135 stars 46 forks source link

nats:2.9.17 image support for PPC64LE Architecture #118

Closed shreyakajbaje closed 8 months ago

shreyakajbaje commented 1 year ago

Hi @bruth @wallyqs I'm working on building nats:2.9.17 image on PPC64LE.

using this dockerfile - https://github.com/nats-io/nats-docker/blob/a7917b933c57aa43adb4d73f4fd7733a0fb545dd/2.9.18/alpine3.18/Dockerfile

Logs - 
Step 1/8 : FROM alpine:3.18
 ---> ada3b5c8c989
Step 2/8 : ENV NATS_SERVER 2.9.21
 ---> Using cache
 ---> 376e10e89fc5
Step 3/8 : RUN set -eux;        apkArch="$(apk --print-arch)";  case "$apkArch" in              aarch64) natsArch='arm64'; sha256='6c2906b5a3b930e842c0a88772b5f484e962ac342f57852a45b1c5a7e10f2197' ;;              armhf) natsArch='arm6'; sha256='424576d72c1f3b5bd309254d0d0462e21b4aaf6b85defcf6663128294b15c16f' ;; armv7) natsArch='arm7'; sha256='3ee6e4db568311c6832b1ec4d76933cc8ee1a783281ed89da5ebe6f602d1c521' ;;            x86_64) natsArch='amd64'; sha256='2bd2878a63efa5bc9b9c3f1d43fd953c7e14b22ba540f7dea19f7fb3a803215d' ;;               x86) natsArch='386'; sha256='6eef61e4a81fb03f47ef8bfe08eab6909846a3404db28b4260630385dc27910f' ;;            ppc64le) natsArch='386'; sha256='' ;;           *) echo >&2 "error: $apkArch is not supported!"; exit 1 ;;      esac;           wget -O nats-server.tar.gz "https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER}/nats-server-v${NATS_SERVER}-linux-${natsArch}.tar.gz";  echo "${sha256} *nats-server.tar.gz" | sha256sum -c -;               apk add --no-cache ca-certificates tzdata;              tar -xf nats-server.tar.gz;     rm nats-server.tar.gz;       mv "nats-server-v${NATS_SERVER}-linux-${natsArch}/nats-server" /usr/local/bin;  rm -rf "nats-server-v${NATS_SERVER}-linux-${natsArch}";
 ---> Running in 8ec06fad3e7a
+ apk --print-arch
+ apkArch=ppc64le
+ natsArch=386
+ sha256=
+ wget -O nats-server.tar.gz https://github.com/nats-io/nats-server/releases/download/v2.9.21/nats-server-v2.9.21-linux-386.tar.gz
Connecting to github.com (140.82.113.3:443)
Connecting to objects.githubusercontent.com (185.199.111.133:443)
saving to 'nats-server.tar.gz'
nats-server.tar.gz   100% |********************************| 4848k  0:00:00 ETA
'nats-server.tar.gz' saved
+ echo ' *nats-server.tar.gz'
+ sha256sum -c -
nats-server.tar.gz: FAILED
sha256sum: WARNING: 1 of 1 computed checksums did NOT match
The command '/bin/sh -c set -eux;       apkArch="$(apk --print-arch)";  case "$apkArch" in              aarch64) natsArch='arm64'; sha256='6c2906b5a3b930e842c0a88772b5f484e962ac342f57852a45b1c5a7e10f2197' ;;              armhf) natsArch='arm6'; sha256='424576d72c1f3b5bd309254d0d0462e21b4aaf6b85defcf6663128294b15c16f' ;;                 armv7) natsArch='arm7'; sha256='3ee6e4db568311c6832b1ec4d76933cc8ee1a783281ed89da5ebe6f602d1c521' ;;            x86_64) natsArch='amd64'; sha256='2bd2878a63efa5bc9b9c3f1d43fd953c7e14b22ba540f7dea19f7fb3a803215d' ;;               x86) natsArch='386'; sha256='6eef61e4a81fb03f47ef8bfe08eab6909846a3404db28b4260630385dc27910f' ;;            ppc64le) natsArch='386'; sha256='' ;;           *) echo >&2 "error: $apkArch is not supported!"; exit 1 ;;  esac;            wget -O nats-server.tar.gz "https://github.com/nats-io/nats-server/releases/download/v${NATS_SERVER}/nats-server-v${NATS_SERVER}-linux-${natsArch}.tar.gz";  echo "${sha256} *nats-server.tar.gz" | sha256sum -c -;          apk add --no-cache ca-certificates tzdata;              tar -xf nats-server.tar.gz;  rm nats-server.tar.gz;  mv "nats-server-v${NATS_SERVER}-linux-${natsArch}/nats-server" /usr/local/bin;  rm -rf "nats-server-v${NATS_SERVER}-linux-${natsArch}";' returned a non-zero code: 1 

could you please share pointers and suggest what is sha256 value refers to?

bruth commented 11 months ago

Hey @shreyakajbaje, that is the SHA256 checksum that is generated as part of a release. The update.py script in the repo handles fetching these and updating the Dockerfile automatically. Since there is no official release build for PPC64LE, you would need to build the binary for that arch and then package. This could be done with a multi-stage Dockerfile where the first stage uses the golang image to build from source followed by a stage that copies in that binary to a smaller image (like Alpine).

bruth commented 8 months ago

@shreyakajbaje we just published 2.10.11 and added supported for ppc64le images. It will be available once this PR is merged.