Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust docker image to be consistent with multiple cpu arch #485

Closed
wants to merge 2 commits into from

Conversation

brunoselvacj
Copy link

After some experiments, I realized that the current image is locked for x86_64. A simple way to have multiple platforms is by using a more generic base image. This version is actually smaller than the original one as well. Old one 510MB vs 464MB new one

@DannyBen
Copy link
Owner

DannyBen commented Feb 5, 2024

Very nice, thank you for this and the other improvements in the Dockerfile.
Let me give it a fresh look and test it tomorrow and I will merge.

@DannyBen DannyBen mentioned this pull request Feb 6, 2024
@DannyBen
Copy link
Owner

DannyBen commented Feb 6, 2024

After testing, I cannot accept this PR.

  • I want the docker image to stay based on alpine
  • I very much prefer it would be based on dannyben/alpine-ruby
  • The pandoc version in your image is 2.x, which is older than the 3.1.9 bashly is tested with

See #486 and #487 - I have added a smoke test for that pandoc version in the docker image, as well as updated the Dockerfile with some of the suggestions in this PR.

Shouldn't this fix be done in the dannyben/alpine-ruby base image?

@brunoselvacj
Copy link
Author

Thank you for the feedback. I think the next step now is just to push the docker image to docker hub for more platforms.

@DannyBen
Copy link
Owner

DannyBen commented Feb 6, 2024

The docker image is not my main focus. It is provided as a convenience.
That said, if there is an easy, elegant and fast way to achieve this, I am open to it.

In the meantime, I will push the current image.

@DannyBen
Copy link
Owner

DannyBen commented Feb 6, 2024

Does this seem right?

# Create a new builder instance
docker buildx create --name mybuilder

# Set the builder to support multiple platforms
docker buildx use mybuilder
docker buildx inspect --bootstrap

# Build the Docker image for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 -t myimage:latest .

@DannyBen
Copy link
Owner

DannyBen commented Feb 6, 2024

I think I figured it out.

Seems like just something like this:

$ docker buildx build --push --platform linux/amd64,linux/arm64 -t dannyben/bashly  .

which platforms do you need?

@DannyBen
Copy link
Owner

DannyBen commented Feb 6, 2024

I have pushed dannyben/bashly:test to dockerhub, which supports both amd64 and arm64v8 - let me know if it is ok for you, or if you need another platform.

@brunoselvacj
Copy link
Author

brunoselvacj commented Feb 6, 2024 via email

@DannyBen
Copy link
Owner

DannyBen commented Feb 7, 2024

Did you try with the bashly image tagged test?
It is built for arm64v8, which is the M1 architecture as I understand.

image

I have now also pushed the multi-arch image for the main bashly image.

$ docker buildx imagetools inspect dannyben/bashly:1.1.6 |grep Platform
  Platform:    linux/amd64
  Platform:    linux/arm64v8

@brunoselvacj
Copy link
Author

brunoselvacj commented Feb 7, 2024 via email

@DannyBen
Copy link
Owner

DannyBen commented Feb 7, 2024

I do not understand.
See the bashly tags - they are the same.

https://hub.docker.com/r/dannyben/bashly/tags

arm64v8 should be the same as arm64 to my understanding.

@brunoselvacj
Copy link
Author

brunoselvacj commented Feb 7, 2024 via email

@DannyBen
Copy link
Owner

DannyBen commented Feb 7, 2024

Does not build. Running

docker buildx build --platform linux/amd64,linux/arm64/v8 -t dannyben/bashly -t dannyben/bashly:1.1.6 .

yields an error:

Invalid ELF image for this architecture

(same with linux/arm64)

@brunoselvacj
Copy link
Author

brunoselvacj commented Feb 7, 2024 via email

@DannyBen
Copy link
Owner

DannyBen commented Feb 8, 2024

Tried. Does not change anything. The error still exists.

As I mentioned the docker image is provided for convenience and not as a primary focus of this repository.
You can either install using Ruby, or build your own docker for your use, as you already did.

If I bump into a simple solution for this Invalid ELF image for this architecture error, I might release the image as multi-arch.

@brunoselvacj
Copy link
Author

brunoselvacj commented Feb 8, 2024 via email

@DannyBen DannyBen mentioned this pull request Feb 8, 2024
@DannyBen
Copy link
Owner

DannyBen commented Feb 8, 2024

Thanks, appreciated.
It annoys me that it does not build for multi-arch. I might try to build using a GitHub action.

I opened #488.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants