|
| 1 | +# |
| 2 | +# Copyright (C) 2025 Red Hat, Inc. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +# SPDX-License-Identifier: Apache-2.0 |
| 17 | + |
| 18 | +name: build-stack |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - 'main' |
| 24 | + |
| 25 | +jobs: |
| 26 | + publish: |
| 27 | + name: publish |
| 28 | + runs-on: ubuntu-24.04 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Update podman |
| 33 | + run: | |
| 34 | + # ubuntu version from kubic repository to install podman we need (v5) |
| 35 | + ubuntu_version='23.10' |
| 36 | + sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" |
| 37 | + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - |
| 38 | + # install necessary dependencies for criu package which is not part of 23.10 |
| 39 | + sudo apt-get install -qq libprotobuf32t64 python3-protobuf libnet1 |
| 40 | + # install criu manually from static location |
| 41 | + curl -sLO http://cz.archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb |
| 42 | + sudo apt-get update -qq |
| 43 | + sudo apt-get -qq -y install podman || { echo "Start fallback steps for podman nightly installation from a static mirror" && \ |
| 44 | + sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" && \ |
| 45 | + curl -L "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - && \ |
| 46 | + sudo apt-get update && \ |
| 47 | + sudo apt-get -y install podman; } |
| 48 | + podman version |
| 49 | + - name: Revert unprivileged user namespace restrictions in Ubuntu 24.04 |
| 50 | + run: | |
| 51 | + # allow unprivileged user namespace |
| 52 | + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 |
| 53 | + - name: Set cgroup_manager to 'cgroupfs' instead of systemd |
| 54 | + run: | |
| 55 | + mkdir -p ~/.config/containers |
| 56 | + cat <<EOT >> ~/.config/containers/containers.conf |
| 57 | + [engine] |
| 58 | + cgroup_manager="cgroupfs" |
| 59 | + EOT |
| 60 | + podman info |
| 61 | +
|
| 62 | + - name: build package |
| 63 | + run: | |
| 64 | + pip install --upgrade build |
| 65 | + python -m build |
| 66 | +
|
| 67 | + - name: Login to ghcr.io |
| 68 | + run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io |
| 69 | + |
| 70 | + - name: Publish Image |
| 71 | + id: publish-image |
| 72 | + run: | |
| 73 | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/podman-ai-lab-stack |
| 74 | + IMAGE_NIGHTLY=${IMAGE_NAME}:nightly |
| 75 | + IMAGE_SHA=${IMAGE_NAME}:${GITHUB_SHA} |
| 76 | + podman build . -f build/Containerfile -t $IMAGE_NIGHTLY |
| 77 | + podman push $IMAGE_NIGHTLY |
| 78 | + podman tag $IMAGE_NIGHTLY $IMAGE_SHA |
| 79 | + podman push $IMAGE_SHA |
0 commit comments