hyness / spring-cloud-config-server

Docker build of the spring-cloud-config-server
Apache License 2.0
74 stars 54 forks source link

Build and publish an ARM variant of the docker image #106

Open stv-io opened 1 year ago

stv-io commented 1 year ago

Currently it seems like the only os/arch combo the docker image being built is linux/amd64.

For our case, it would be a cost-saving initiative to have an ARM image, to be able to utilise the more cost effective (and for the next 12 months, essentially free) t4g instances in AWS (currently running nicely and happily, 24x7 on t2.small)

Reference - https://aws.amazon.com/ec2/faqs/#t4g-instances

I'm not familiar (yet) with buildpack configuration, so I won't be able to submit a PR myself as of this time.

hyness commented 1 year ago

Hello @stv-io ,

I think it's a great idea to provide OCI images for other architectures. If you can provide a PR, I would gladly accept it. If not, I can guarantee I will look into adding this, I just cannot say when I will have time

Thanks!

stv-io commented 1 year ago

I would be happy to do so, but for me to be using tools I'm comfortable with, I'd expect the gradle build and the docker build to be separate processes. i.e../gradlew clean build builds a jar, and that jar is dropped into a docker image, using a Dockerfile.

Also, according to the buildpack docs:

As of today, there are no known released CNB builder images that support building ARM application images.

So, I would say, as the maintainer of this repo, would you be happy with replacing the github actions with their "functional equivalent" for building the jar via gradle, and then the container image using docker/podman/kaniko or similar? If so, I'd be happy to create a PR

hyness commented 1 year ago

Hello @stv-io . We only recently converted the build from an exploded jar using Dockerfiles to CNB, I don't want to go backwards. There is more to that link to describe how it can be done with a custom build invoking the lifecycle directly. Also, I'm interested in exploring a native build with GraalVM and Spring Boot 3.0, which would make it easy to build for multiple architectures. However, all of that will take time, which I'm in short supply of currently. You are welcome to fork the project and change how it's built until a time where I can supply the ARM images without using a Dockerfile

Mahooki commented 1 year ago

In case it helps, I needed a native ARM version and was able to build and run it by just replacing the paketo builder (which doesn't seem to support ARM builds yet) to builder.set("dashaun/builder-arm:tiny").

image
hyness commented 1 year ago

Hello @Mahooki ,

Thank you very much for this! I will definitely see about integrating that into the build, hopefully soon (I feel terribly guilty that this was requested so long ago and haven't been able to accommodate the request).

Thanks again!

hyness commented 12 months ago

I explored using this builder to create arm64 images, however it builds a native image which isn't support by Spring Cloud Config Server. Looks like this requires a lower level Dockerfile build. I will gladly accept a PR for this, if I don't receive one, I will try to implement this when I have time, which has been in short supply