aidan-gallagher/debpic

Support Apptainer and/or Singularity containers

Opened this issue · 4 comments

Lately I find it convenient to build Debian packages in containers. I found Apptainer to be the most convenient for me. Since Apptainer container definition files are not much different from Docker ones (the last time I checked), I think it would not be too much work to implement Apptainer support in debpic.

Thanks for the suggestion @merkys.

I was going to add support to allow debpic to use podman instead of docker.

Since podman and docker have the same syntax for the dockerfile and same command line interface (CLI) I believe I could let the user decide which container runtime they want to use. I would have a flag like debpic --container podman which would generate podman calls instead of docker calls.

If apptainer has the same syntax as dockerfile and same CLI as docker then I could add it as an option too. Do you know if it does?

This is the first I've heard of apptainer so I'll have to look into it.

Out of interest why would you prefer debpic to use apptainer over docker?

Thanks for the suggestion @merkys.

I was going to add support to allow debpic to use podman instead of docker.

Since podman and docker have the same syntax for the dockerfile and same command line interface (CLI) I believe I could let the user decide which container runtime they want to use. I would have a flag like debpic --container podman which would generate podman calls instead of docker calls.

Sounds good.

If apptainer has the same syntax as dockerfile and same CLI as docker then I could add it as an option too. Do you know if it does?

AFAIK, Apptainer and Singularity have identical container definition file syntax and CLI options. They differ slightly from Docker, but from what I remember of Docker are very close. If you can share example Dockerfiles built by debpic, I can help adapting them for Apptainer/Singularity.

This is the first I've heard of apptainer so I'll have to look into it.

Out of interest why would you prefer debpic to use apptainer over docker?

Just to clarify, I would prefer to be able to choose Apptainer or Singularity as container runner backend. I do not suggest replacing Docker with any of them. Since all three seem really close to me, I think all three could be supported alongside with minimal maintenance burden.

I prefer Apptainer over Docker as Apptainer's containers are actually files, thus, e.g., to remove them it is enough to rm.

AFAIK, Apptainer and Singularity have identical container definition file syntax and CLI options. They differ slightly from Docker, but from what I remember of Docker are very close. If you can share example Dockerfiles built by debpic, I can help adapting them for Apptainer/Singularity.

Here is the dockerfile debpic uses can be found here: https://github.com/aidan-gallagher/debpic/blob/main/debpic/Dockerfile
The docker commands can be seen in the terminal when you run debpic.

Here is the dockerfile debpic uses can be found here: https://github.com/aidan-gallagher/debpic/blob/main/debpic/Dockerfile

It should be trivial to write a script to convert this Dockerfile into a container definition files for Apptainer/Singularity. ARG and RUN prefixes, I can try to do this.