Hi, mate.
I believe you can use this answer on SO
https://stackoverflow.com/a/35062090 replacing `docker` with `podman`
as it fully supports docker API.
So I would write a file named `Dockerfile`:
FROM openjdk:11
MAINTAINER t.schneider(a)getgoogleoff.me
COPY~/.mpw-gui/masterpassword-gui.jar /home/masterpassword-gui.jar
CMD ["java","-jar","/home/masterpassword-gui.jar"]
Notice that I used FROM openjdk:11, you don't have to build your own
separate openjdk image as it's already built by guys from openjdk,
please use your current project version of JDK for it:
https://hub.docker.com/_/openjdk
Build your image:
podman build -t imageName .
Now invoke your program inside a container:
podman run --name myProgram imageName
Now restart your program by restarting the container:
podman restart myProgram
Your program changed? Rebuild the image!:
podman rmi imageName
podman build -t imageName .
Additionally, usually we don't build images by hand, we use maven or
gradle for this.
For instance, google created a tool called JIB, which creates OCI
images with java programs automatically:
https://cloud.google.com/java/getting-started/jib
Also, we use this maven plugin to build docker image with jar file of
our project without writing Dockerfile at all:
https://dmp.fabric8.io/
It should work the same way with both docker and podman.
вт, 28 нояб. 2023 г. в 02:02, Thomas <t.schneider(a)getgoogleoff.me>:
Hello,
I have successfully build docker image "sapmachine", a build of OpenJDK.
Now I want to build my own image to run my own jar file.
This jar file is located in ~/.mpw-gui/masterpassword-gui.jar, and with
locally installed OpenJDK I would run this command: java -jar
.mpw-gui/masterpassword-gui.jar
Could you please advise how to build my own image for this java application?
THX
_______________________________________________
Podman mailing list -- podman(a)lists.podman.io
To unsubscribe send an email to podman-leave(a)lists.podman.io
--
С уважением,
А.И.