edannenberg / kubler

A generic, extendable build orchestrator.
BSD 2-Clause "Simplified" License
158 stars 40 forks source link

Podman engine support #159

Open babykart opened 5 years ago

babykart commented 5 years ago

Hi,

podman (https://github.com/containers/libpod) support all docker commands, Dockerfiles, and it can be run as user. You can find in attachment podman.sh that is a copy of the engine/docker.sh with minor modifications. The bob-*, builder and image templates does not need modifications. Install podman on gentoo:

emerge -av libpod
cd ${_kubler_install_dir}
ln -sr template/docker template/podman
ln -sr engine/docker engine/podman
wget https://github.com/edannenberg/kubler/files/3161965/podman.txt -O engine/podman.sh

podman.txt

Let me know if you prefer a PR...

PS - @edannenberg thank you for this awesome project.

edannenberg commented 5 years ago

Hey,

thank you for this! A PR would indeed be prefered but no worries if you are busy.

Had a quick look at the changes, as Podman seems to be a true in-place replacement for Docker we should try to reduce code duplication as much as possible. You can kinda "extend" docker.sh like so:

#!/usr/bin/env bash

source "${_KUBLER_DIR}"/engine/docker.sh

# override functions/vars as required..
DOCKER="podman"

As most changes are related to var names and output it might be better to change docker.sh so it can be extended without having to duplicate a lot of code. Let me know if you need help with that, you can also hit me up on Discord.

babykart commented 5 years ago

Clearly a better approach than mine. With your approach, the only modification needed in engine/docker.sh is to avoid '-f' argument for 'podman image prune' in _buildimage():

    [[ "${KUBLER_POSTBUILD_IMAGE_PRUNE}" == 'true' ]] \
        && _status_msg="remove untagged images" && pwrap "${DOCKER}" image prune -f

I will working on it this week end and after some tests, I will do a PR.