mostafa / xk6-kafka

k6 extension to load test Apache Kafka with support for various serialization formats, SASL, TLS, compression, Schema Registry client and beyond
Apache License 2.0
153 stars 69 forks source link

Make docker image supports on arm #277

Closed guyarb closed 8 months ago

guyarb commented 8 months ago

The current docker image does not support arm hosts Is it possible to make the docker image supported both arm and amd for linux?

mostafa commented 8 months ago

Hey @guyarb,

That is absolutely possible, yet I don't have a machine to test that. Is that something you'd be willing to do? Let me know if you need anything.

guyarb commented 8 months ago

Sure! once there is an image I can test it

mostafa commented 8 months ago

Hey @guyarb,

Run these commands on your machine to see if the resulting image works for you. Considering that you have Go 1.22 installed and available on your $PATH:

git clone git@github.com:mostafa/xk6-kafka.git && cd xk6-kafka
mkdir dist
go install go.k6.io/xk6/cmd/xk6@latest
GOOS=linux GOARCH=arm64 xk6 build --output dist/xk6-kafka_v0.23.1_linux_arm64 --with github.com/mostafa/xk6-kafka@v0.23.1=.
docker build --platform linux/arm64 --build-arg "VERSION_TAG=v0.23.1" --tag xk6-kafka:v0.23.1 .
docker image inspect $(docker images -q xk6-kafka) | jq '.[] | .Architecture' # SHOULD PRINT "arm64"
docker run --rm -i xk6-kafka:v0.23.1 run - <scripts/test_json.js # THIS SHOULD WORK

If all the above commands work as expected on your machine, I'll merge this PR and release a multi-platform image that you can use.

DanielLavie commented 8 months ago

Hey @mostafa, I've tested it on my ARM machine and it worked fine. I just used the following command: docker build --platform linux/arm64 --build-arg "VERSION_TAG=v0.23.1" --build-arg "K6_BINARY=dist/xk6-kafka_v0.23.1_linux_arm64" --tag xk6-kafka:v0.23.1 . instead of your original one

mostafa commented 8 months ago

@guyarb

Forgot to mention that you should also switch to the branch to test the changes. But that's okay. I'll try to release a version to see if it works. If not, I'll fix it and release another version.

mostafa commented 8 months ago

@guyarb @DanielLavie Now the arm64 image is available on Docker Hub. Please test it.

guyarb commented 8 months ago

@mostafa amazing, we tested it and it works Thank you for the taking care of it 🙇🏻

mostafa commented 8 months ago

@guyarb Perfect! Glad it was helpful.