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

Support for Docker and Podman build on mac silicon (ARM) #242

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

zubcevic
Copy link
Contributor

@zubcevic zubcevic commented Dec 8, 2023

This makes it possible to run the container builds on MacOS with silicon chips as well as other platforms that have either podman or docker installed.

To use:
unchanged: ./mvnw clean install -PbuildDocker

or if you prefer podman:
./mvnw clean install -PbuildDocker -Dcontainer.executable=podman

@zubcevic
Copy link
Contributor Author

zubcevic commented Dec 8, 2023

#180

@arey arey added the bug label Dec 18, 2023
pom.xml Show resolved Hide resolved
@arey arey changed the title support for docker and podman build on mac silicon Support for Docker and Podman build on mac silicon Dec 20, 2023
@arey arey changed the title Support for Docker and Podman build on mac silicon Support for Docker and Podman build on mac silicon (ARM) Dec 20, 2023
Documentation for the podman alternative has been added
@arey arey merged commit d07a6ef into spring-petclinic:master Dec 21, 2023
1 check passed
@arey
Copy link
Member

arey commented Dec 21, 2023

Thank you for your contribution René

@arey
Copy link
Member

arey commented Dec 22, 2023

Hi @zubcevic

I recovered these changes. Building docker image on my Intel Macbook and Docker Machine is working.
But I've got the follwing error while starting the discovery-server

arey:~$docker-compose up                 
grafana-server is up-to-date
prometheus-server is up-to-date
config-server is up-to-date
tracing-server is up-to-date
Starting discovery-server ... error

ERROR: for discovery-server  Cannot start service discovery-server: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "./dockerize": stat ./dockerize: no such file or directory: unknown

Do you have any idea?

Image build is successful with the exec-maven-plugin:

mvn clean install -P buildDocker -X
[DEBUG] Executing command line: [docker, build, -f, Dockerfile, --build-arg, ARTIFACT_NAME=spring-petclinic-discovery-server-3.0.9, --build-arg, EXPOSED_PORT=8761, --build-arg, DOCKERIZE_VERSION=v0.6.1, -t, springcommunity/spring-petclinic-discovery-server, /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-microservices/spring-petclinic-discovery-server/target]
time="2023-12-22T19:04:53+01:00" level=warning msg="No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load"
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 951B 0.0s done
#1 DONE 0.0s
...
...
#15 [stage-1 7/7] COPY --from=builder application/application/ ./
#15 DONE 0.0s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

With the docker images command line I detect my local Docker image has not been build.

If I return to the docker-maven-plugin build I can see the image hash and the image tag:

...
 ---> 1689d15fa2a2
Step 20/20 : ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

 ---> Running in 31249573a91a
Removing intermediate container 31249573a91a
 ---> 2e778a7379c2
ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
Successfully built 2e778a7379c2
Successfully tagged springcommunity/spring-petclinic-discovery-server:latest
[INFO] Built springcommunity/spring-petclinic-discovery-server
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
$docker --version
Docker version 20.10.11, build dea9396

Maybe adding a --load flag

arey:~$docker build -f ../docker/Dockerfile --load --build-arg ARTIFACT_NAME=spring-petclinic-discovery-server-3.0.9 --build-arg EXPOSED_PORT=8761 --build-arg DOCKERIZE_VERSION=v0.6.1 -t springcommunity/spring-petclinic-discovery-server /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-microservices/spring-petclinic-discovery-server/target

@arey
Copy link
Member

arey commented Dec 22, 2023

Fixed by #246

DavidMolta18 pushed a commit to Distribuidos2024/spring-petclinic-microservices that referenced this pull request Nov 14, 2024
…linic#242)

* support for docker and podman build on mac silicon

* Update README.md

Documentation for the podman alternative has been added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants