artefactual-labs / docker-gearmand

Docker image of gearmand based on Alpine Linux.
https://hub.docker.com/r/artefactual/gearmand/
Apache License 2.0
19 stars 13 forks source link

Native ARM64 support #18

Closed j03k64 closed 11 months ago

j03k64 commented 11 months ago

I assume you have access to push multiple architecture builds for the same image. I was able to confirm that building on ARM64 works fine on my M1 Mac. I was wondering if was possible to push an ARM64 architecture tag so that this can run without emulation on ARM-based machines.

Using the Dockerfile from the 1.1.20 release:

/usr/local/bin $ cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.8
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
/usr/local/bin $ uname -a
Linux 5bb5a64f0e90 6.4.16-linuxkit #1 SMP PREEMPT Thu Nov 16 10:49:20 UTC 2023 aarch64 Linux
/usr/local/bin $ ./gearadmin  --status
.
/usr/local/bin $ ./gearadmin  --getpid
1
/usr/local/bin $ ./gearadmin  --show-unique-jobs
.
/usr/local/bin $ ps
PID   USER     TIME  COMMAND
    1 gearman   0:00 gearmand
   14 gearman   0:00 /bin/sh
   36 gearman   0:00 ps

Logs

2023-12-05 22:06:29    INFO 2023-12-06 03:06:29.448364 [  main ] Initializing Gear on port 4730 with SSL: false
2023-12-05 22:06:29    INFO 2023-12-06 03:06:29.000000 [  main ] Starting up with pid 1, verbose is set to INFO
2023-12-05 22:06:29    INFO 2023-12-06 03:06:29.000000 [  main ] Listening on 0.0.0.0:4730 (9)
2023-12-05 22:06:29    INFO 2023-12-06 03:06:29.000000 [  main ] Adding event for listening socket (9)
2023-12-05 22:07:56    INFO 2023-12-06 03:07:56.000000 [  main ] Accepted connection from 127.0.0.1:48002
2023-12-05 22:07:56    INFO 2023-12-06 03:07:56.000000 [     4 ] Peer connection has called close()
2023-12-05 22:07:56    INFO 2023-12-06 03:07:56.000000 [     4 ] Disconnected 127.0.0.1:48002
2023-12-05 22:07:56    INFO 2023-12-06 03:07:56.000000 [     4 ] Gear connection disconnected: -:-
2023-12-05 22:08:03    INFO 2023-12-06 03:08:02.000000 [  main ] Accepted connection from 127.0.0.1:48016
2023-12-05 22:08:03    INFO 2023-12-06 03:08:02.000000 [     3 ] Peer connection has called close()
2023-12-05 22:08:03    INFO 2023-12-06 03:08:02.000000 [     3 ] Disconnected 127.0.0.1:48016
2023-12-05 22:08:03    INFO 2023-12-06 03:08:02.000000 [     3 ] Gear connection disconnected: -:-
2023-12-05 22:08:13    INFO 2023-12-06 03:08:12.000000 [  main ] Accepted connection from 127.0.0.1:43976
2023-12-05 22:08:13    INFO 2023-12-06 03:08:12.000000 [     2 ] Peer connection has called close()
2023-12-05 22:08:13    INFO 2023-12-06 03:08:12.000000 [     2 ] Disconnected 127.0.0.1:43976
2023-12-05 22:08:13    INFO 2023-12-06 03:08:12.000000 [     2 ] Gear connection disconnected: -:-
sevein commented 11 months ago

Do you know how can I do that without access to a Mac?

j03k64 commented 11 months ago

Hey @sevein I've used docker buildx in the past with success: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

I forked your repo (which I don't want to maintain long term, but used it as a proof of concept for you) on an x86 machine I did (after installing buildx plugin):

docker login
cd 1.1.20/

docker buildx build -t shootproof/docker-gearmand:latest --platform linux/arm64,linux/amd64 --push .

You can see the multiple tags here: https://hub.docker.com/r/shootproof/docker-gearmand/tags

image

You'll need to obviously update the -t argument to artefactual/gearmand.

sevein commented 11 months ago

I think it worked! I didn't know that buildkit had qemu emulation support, that's amazing. I've published a new image with the latest version of alpine and gearman 1.1.21.

https://hub.docker.com/r/artefactual/gearmand/tags?page=1&name=1.1.21

j03k64 commented 11 months ago

Thank you so much! It looks like it's working as expected!

image image

I've deleted my fork.

Don't forget to update the latest tag and the README.md file :-)

sevein commented 11 months ago

Thanks, just pushed latest.