|
| 1 | +--- |
| 2 | +name: "Setup Podman Environment" |
| 3 | +description: "Prepare Podman for rootless builds" |
| 4 | + |
| 5 | +runs: |
| 6 | + using: "composite" |
| 7 | + steps: |
| 8 | + |
| 9 | + - name: Remove Docker if installed |
| 10 | + shell: bash |
| 11 | + run: | |
| 12 | + if command -v docker >/dev/null 2>&1; then |
| 13 | + echo "Docker found removing" |
| 14 | + sudo systemctl stop docker docker.socket || true |
| 15 | + sudo apt-get purge -y \ |
| 16 | + docker \ |
| 17 | + docker.io \ |
| 18 | + docker-ce \ |
| 19 | + docker-ce-cli \ |
| 20 | + containerd runc || true |
| 21 | + sudo apt-get autoremove -y |
| 22 | + sudo rm -rf /var/lib/docker /var/lib/containerd |
| 23 | + else |
| 24 | + echo "Docker not installed" |
| 25 | + fi |
| 26 | +
|
| 27 | + - name: Install dependencies |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y \ |
| 32 | + podman \ |
| 33 | + python3-pip \ |
| 34 | + fuse-overlayfs \ |
| 35 | + uidmap \ |
| 36 | + qemu-user-static |
| 37 | +
|
| 38 | + - name: Enable lingering for current user |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + sudo loginctl enable-linger $USER || true |
| 42 | +
|
| 43 | + - name: Create Podman config directories |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + mkdir -p ~/.config/containers |
| 47 | + mkdir -p ~/.local/share/containers |
| 48 | +
|
| 49 | + - name: Configure rootless Podman storage |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + cat <<'EOF' > ~/.config/containers/storage.conf |
| 53 | + [storage] |
| 54 | + driver = "overlay" |
| 55 | + runroot = "/tmp/run-$(id -u)" |
| 56 | + graphroot = "$HOME/.local/share/containers/storage" |
| 57 | + [storage.options] |
| 58 | + mount_program = "/usr/bin/fuse-overlayfs" |
| 59 | + EOF |
| 60 | +
|
| 61 | + - name: Migrate Podman storage (if needed) |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + podman system migrate || true |
| 65 | +
|
| 66 | + - name: Install podman-compose from PyPI |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + pip install --upgrade pip |
| 70 | + pip install podman-compose |
| 71 | +
|
| 72 | + - name: Verify Podman and podman-compose |
| 73 | + shell: bash |
| 74 | + run: | |
| 75 | + podman --version |
| 76 | + podman-compose version |
0 commit comments