How to Install an App for an Image with EULA

I want to install a GUI app in a container. I could get the GUI to run with X11. Now I want to include the installation of the app in the image as well. The problem is, it asks for consent from EULA, which I can not bypass. So there will be a halt in the build process of the image, since this consent must be done.A silent installation is also not possible so far, at least I have not found out any. Is there a recommended way to do this?
Since I am still quite new, I wonder if there is a way to do the installation once in the GUI in the container and then save this state as an image?
Or do you have another idea?

I think you can commit the changes made to a running container to create a new image.