BUILD PODMAN

This commit is contained in:
Shihaam Abdul Rahman 2023-02-28 13:34:12 +05:00
commit 6079de2694
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636
5 changed files with 127 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
build/*
build

9
README.md Normal file
View File

@ -0,0 +1,9 @@
## Build latest podman for debian
```bash
git clone git@gitlab.com:alliedmaldives/ops/podmanbuilder.git
cd podmanbuilder
docker compose run --rm podman-builder /bin/bash -c 'bash /root/buildscript.sh'
```
you should have the .deb file in a folder called 'build'

2
build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
docker compose run --rm podman-builder /bin/bash -c 'bash /root/buildscript.sh'

104
buildscript.sh Normal file
View File

@ -0,0 +1,104 @@
#!/bin/bash
cd /root/
apt update
apt upgrade -y
apt-get install \
btrfs-progs \
crun \
git \
golang-go \
go-md2man \
iptables \
libassuan-dev \
libbtrfs-dev \
libc6-dev \
libdevmapper-dev \
libglib2.0-dev \
libgpgme-dev \
libgpg-error-dev \
libprotobuf-dev \
libprotobuf-c-dev \
libseccomp-dev \
libselinux1-dev \
libsystemd-dev \
pkg-config \
uidmap
apt install -y jq wget curl
VERSION=$(curl -s https://api.github.com/repos/containers/podman/releases/latest | jq '.name' -r)
export VERSION
git clone https://github.com/containers/podman.git podman-$VERSION
cd podman-$VERSION
git checkout tags/$VERSION
make ENABLE_BUILDTAGS="systemd" binaries
cp -vr bin/ ..
cd ..
VERSION=$(echo $VERSION | sed s/v//)
## PREPARE to package into .deb
mkdir -p podman-deb/DEBIAN
mkdir -p podman-deb/usr/local/bin
mkdir -p podman-deb/usr/lib/systemd/system/
cat <<EOF > podman-deb/DEBIAN/control
Package: podman
Version: $VERSION
Section: base
Priority: optional
Architecture: amd64
Maintainer: Shiham Abdul Rahman <shihaam@shihaam.me>
Description: Podman container engine
Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System.
EOF
cat <<EOF > podman-deb/usr/lib/systemd/system/podman.service
[Unit]
Description=Podman API Service
Requires=podman.socket
After=podman.socket
Documentation=man:podman-system-service(1)
StartLimitIntervalSec=0
[Service]
Delegate=true
Type=exec
KillMode=process
Environment=LOGGING="--log-level=info"
ExecStart=/usr/bin/podman $LOGGING system service
[Install]
WantedBy=default.target
EOF
cat <<EOF > podman-deb/usr/lib/systemd/system/podman.socket
[Unit]
Description=Podman API Socket
Documentation=man:podman-system-service(1)
[Socket]
ListenStream=%t/podman/podman.sock
SocketMode=0660
[Install]
WantedBy=sockets.target
EOF
cp -v bin/podman podman-deb/usr/local/bin/
cp -v bin/podman-remote podman-deb/usr/local/bin/
cp -v bin/quadlet podman-deb/usr/local/bin/
cp -v bin/rootlessport podman-deb/usr/local/bin/
# ofc the permission
chmod 755 podman-deb/usr/local/bin/*
dpkg-deb --build podman-deb build

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: '3.5'
services:
#########################
podman-builder:
hostname: podman-builder
image: ubuntu
volumes:
- ./build:/root/build
- ./buildscript.sh:/root/buildscript.sh