Skip to content
New issue

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

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

Already on GitHub? # to your account

Enhancement: Tolerate build: directive in compose file #70

Closed
kronenpj opened this issue Mar 31, 2024 · 4 comments
Closed

Enhancement: Tolerate build: directive in compose file #70

kronenpj opened this issue Mar 31, 2024 · 4 comments

Comments

@kronenpj
Copy link

K9,

May I suggest an approach to tolerating build: directives in compose files: Utilize the stanza title or container_name to infer the name of the local image. For example:

# redis
netbox-redis:
    container_name: netbox-redis
    hostname: redis
    #image: localhost/netbox-redis:latest
    build: ./valkey

Podman compose will generate a container called netbox-redis with a latest tag. Without the container_name tag this image would be created from the current directory and the netbox-redis key. If an image isn't found, an error is warranted.

I don't know how much effort this would be but it would add a little compatibility to this excellent tool.

@k9withabone
Copy link
Member

k9withabone commented Apr 1, 2024

I'm not sure if this is a good idea. The reason podlet does not currently support build in compose services is that quadlet does not directly support building an image before running a container. Quadlet .container files map to podman run commands in the generated systemd service. You could create a service which builds the image and then add it to Requires= and After= in the [Unit] section of the .container quadlet file. I feel like this may be out of scope for podlet as the specifics of how you wish to build the image will likely be highly dependent on your setup. Perhaps you could ask the podman team to add a Build= directive to .image quadlet files?

@kronenpj
Copy link
Author

kronenpj commented Apr 1, 2024

Ah, hadn't considered that aspect and the relationship between the .container files and the podman run command line. I was trying to keep the compose.yml file in one piece for building and starting. However, it's easy enough to split, so I'll go that route. Thanks for the consideration!

@kronenpj kronenpj closed this as completed Apr 1, 2024
@tomhense
Copy link

Could this issue be reopened? Quadlet now seems to support .build files

@k9withabone
Copy link
Member

Sorry that I missed this. I'm going through old notifications. #100 is technically a duplicate, but I'll leave this issue closed and that one open to hopefully reduce confusion.

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

No branches or pull requests

3 participants