Skip to content

Commit 22defa1

Browse files
committed
Add AlmaLinux
1 parent f69ff32 commit 22defa1

8 files changed

+339
-5
lines changed

.devcontainer/almalinux/Containerfile

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
ARG BASE_IMAGE="almalinux"
2+
ARG BASE_VERSION="9"
3+
4+
FROM ${BASE_IMAGE}:${BASE_VERSION}
5+
6+
ARG USER="gbraad"
7+
ARG USER_PASSWD
8+
ARG HOMEBASE="/home"
9+
ARG USERHOME="${HOMEBASE}/${USER}"
10+
ARG ROOTHOME="/root"
11+
ARG ARCH="x86_64"
12+
13+
RUN dnf install -y \
14+
systemd \
15+
sudo \
16+
git \
17+
dnf-plugins-core \
18+
&& dnf install -y --allowerasing --nobest \
19+
util-linux \
20+
util-linux-user \
21+
&& dnf install -y \
22+
epel-release \
23+
epel-next-release \
24+
&& dnf clean all \
25+
&& rm -rf /var/cache/yum
26+
27+
# fix for PAM/SSH
28+
RUN chmod 0640 /etc/shadow
29+
30+
RUN useradd -l -u 1000 -G wheel -md ${USERHOME} -s /bin/bash -p ${USER} ${USER} \
31+
&& sed -i.bkp -e 's/%wheel\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%wheel ALL=NOPASSWD:ALL/g' /etc/sudoers \
32+
&& if [ -n "${USER_PASSWD}" ] ; then \
33+
echo "gbraad:${USER_PASSWD}" | sudo chpasswd && echo "Password set to: ${USER_PASSWD}"; \
34+
fi
35+
36+
USER ${USER}
37+
38+
RUN git clone https://github.com/gbraad-dotfiles/upstream.git ${USERHOME}/.dotfiles --depth 2 \
39+
&& cd ${USERHOME}/.dotfiles \
40+
&& sh ./install.sh
41+
42+
RUN mkdir -p ~/.ssh/ \
43+
&& curl https://github.com/${USER}.keys | tee -a ~/.ssh/authorized_keys
44+
45+
USER root
46+
47+
RUN git clone https://github.com/gbraad-dotfiles/upstream.git ${ROOTHOME}/.dotfiles --depth 2 \
48+
&& cd ${ROOTHOME}/.dotfiles \
49+
&& . ./zsh/.zshrc.d/dotfiles.zsh \
50+
&& stow config \
51+
&& dotfiles restow
52+
53+
RUN chsh -s /usr/bin/zsh ${USER} \
54+
&& chsh -s /usr/bin/zsh
55+
56+
# install tailscale (or use https://github.com/spotsnel/tailscale-systemd/)
57+
RUN dnf config-manager --add-repo https://pkgs.tailscale.com/stable/rhel/9/tailscale.repo \
58+
&& dnf install -y \
59+
tailscale \
60+
&& dnf clean all \
61+
&& rm -rf /var/cache/yum \
62+
&& mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale \
63+
&& systemctl enable tailscaled
64+
65+
# install cloudflared (or use https://github.com/spotsnel/cloudflared-systemd/)
66+
RUN dnf install -y \
67+
systemd \
68+
&& curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${ARCH}.rpm -o /tmp/cloudflared.rpm \
69+
&& dnf install -y \
70+
/tmp/cloudflared.rpm \
71+
&& dnf clean all \
72+
&& rm -rf /var/cache/yum \
73+
&& rm -f /tmp/cloudflared.rpm
74+
75+
# Enable systemd
76+
ENTRYPOINT [ "/sbin/init" ]
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "AlmaLinux dotfiles environment",
3+
"image": "ghcr.io/gbraad-dotfiles/centos:latest",
4+
5+
"runArgs": [ "--cap-add=NET_ADMIN", "--cap-add=NET_RAW", "--device=/dev/net/tun", "--device=/dev/fuse"],
6+
"overrideCommand": false,
7+
"privileged": true,
8+
"remoteUser": "gbraad",
9+
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"ms-vscode.Theme-TomorrowKit"
14+
]
15+
}
16+
}
17+
}

.devcontainer/ubi9/Containerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ RUN chsh -s /usr/bin/zsh ${USER} \
5858
&& chsh -s /usr/bin/zsh
5959

6060
# install tailscale (or use https://github.com/spotsnel/tailscale-systemd/)
61-
RUN dnf config-manager --add-repo https://pkgs.tailscale.com/stable/centos/9/tailscale.repo \
61+
RUN dnf config-manager --add-repo https://pkgs.tailscale.com/stable/rhel/9/tailscale.repo \
6262
&& dnf install -y \
6363
tailscale \
6464
&& dnf clean all \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: build container - almalinux-bootc
2+
run-name: Building container - AlmaLinux bootc
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: build-container-almalinux-bootc
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
steps:
18+
- name: Check out repository code
19+
uses: actions/checkout@v4
20+
21+
- name: Run podman build - almalinux-bootc
22+
run: |
23+
podman build -t ghcr.io/gbraad-dotfiles/almalinux-bootc:latest \
24+
--build-arg=BASE_IMAGE="quay.io/almalinuxorg/almalinux-bootc" \
25+
--build-arg=BASE_VERSION=9 \
26+
--build-arg=HOMEBASE="/var/home" \
27+
--build-arg=USER_PASSWD="password" \
28+
--build-arg=ROOTHOME="/var/roothome" \
29+
-f .devcontainer/almalinux/Containerfile .
30+
31+
- name: Tag and push image to ghcr.io - almalinux-bootc
32+
run: |
33+
DATE=$(date +"%y%m%d")
34+
podman tag ghcr.io/gbraad-dotfiles/almalinux-bootc:latest \
35+
ghcr.io/gbraad-dotfiles/almalinux-bootc:9
36+
podman tag ghcr.io/gbraad-dotfiles/almalinux-bootc:latest \
37+
ghcr.io/gbraad-dotfiles/almalinux-bootc:${DATE}
38+
podman login ghcr.io -u ${{ github.actor }} \
39+
-p ${{ secrets.GITHUB_TOKEN }}
40+
podman push ghcr.io/gbraad-dotfiles/almalinux-bootc:${DATE}
41+
podman push ghcr.io/gbraad-dotfiles/almalinux-bootc:stream9
42+
podman push ghcr.io/gbraad-dotfiles/almalinux-bootc:latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: build container - almalinux
2+
run-name: Building container - AlmaLinux
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: build-container-almalinux
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
steps:
18+
- name: Check out repository code
19+
uses: actions/checkout@v4
20+
21+
- name: Run podman build - almalinux
22+
run: |
23+
podman build -t ghcr.io/gbraad-dotfiles/almalinux:latest \
24+
--build-arg=BASE_IMAGE="ghcr.io/almalinux/9-init" \
25+
--build-arg=BASE_VERSION="9" \
26+
-f .devcontainer/almalinux/Containerfile .
27+
28+
- name: Tag and push image to ghcr.io - almalinux
29+
run: |
30+
DATE=$(date +"%y%m%d")
31+
podman tag ghcr.io/gbraad-dotfiles/almalinux:latest \
32+
ghcr.io/gbraad-dotfiles/almalinux:9
33+
podman tag ghcr.io/gbraad-dotfiles/almalinux:latest \
34+
ghcr.io/gbraad-dotfiles/almalinux:${DATE}
35+
podman login ghcr.io -u ${{ github.actor }} \
36+
-p ${{ secrets.GITHUB_TOKEN }}
37+
podman push ghcr.io/gbraad-dotfiles/almalinux:${DATE}
38+
podman push ghcr.io/gbraad-dotfiles/almalinux:9
39+
podman push ghcr.io/gbraad-dotfiles/almalinux:latest
40+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: build diskimage - almalinux-bootc - upload
2+
run-name: building diskimage - almalinux-bootc - upload
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
DISK_TYPE: qcow2
8+
ROOTFS: xfs
9+
ARCH: amd64
10+
BIB_IMAGE: quay.io/centos-bootc/bootc-image-builder:latest
11+
12+
jobs:
13+
build:
14+
name: Build qcow2 diskimage - dotfiles
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os:
20+
- ubuntu-24.04
21+
22+
steps:
23+
- name: Remove unwanted stuff
24+
uses: gbraad-actions/remove-unwanted@v1
25+
26+
- uses: actions/checkout@v4
27+
28+
- name: Workaround podman issues in GH actions
29+
run: |
30+
# see https://github.com/osbuild/bootc-image-builder/issues/446
31+
sudo rm -rf /var/lib/containers/storage
32+
sudo mkdir -p /etc/containers
33+
echo -e "[storage]\ndriver = \"overlay\"\nrunroot = \"/run/containers/storage\"\ngraphroot = \"/var/lib/containers/storage\"" | sudo tee /etc/containers/storage.conf
34+
35+
- name: Workarounds for GH runner diskspace
36+
run: |
37+
sudo mkdir -p /mnt/var/lib/containers
38+
sudo mount -o bind /mnt/var/lib/containers /var/lib/containers
39+
sudo mkdir /var/lib/containers/storage
40+
41+
- name: Create empty user configuration
42+
run: touch config.toml
43+
44+
- name: Build image - centos
45+
id: build-image-dotfiles
46+
run: |
47+
mkdir -p ./output
48+
sudo podman pull ${{ env.IMAGE_NAME }}
49+
sudo podman run \
50+
--rm \
51+
-it \
52+
--privileged \
53+
--pull=newer \
54+
--security-opt label=type:unconfined_t \
55+
-v ./config.toml:/config.toml:ro \
56+
-v ./output:/output \
57+
-v /var/lib/containers/storage:/var/lib/containers/storage \
58+
${{ env.BIB_IMAGE }} \
59+
--target-arch ${{ env.ARCH }} \
60+
--type ${{ env.DISK_TYPE }} \
61+
--rootfs ${{ env.ROOTFS }} \
62+
--local \
63+
${{ env.IMAGE_NAME }}
64+
env:
65+
IMAGE_NAME: ghcr.io/gbraad-dotfiles/almalinux-bootc:latest
66+
67+
- name: Rename output file - dotfiles
68+
run: sudo mv ./output/qcow2/disk.qcow2 ./output/qcow2/almalinux-disk.qcow2
69+
70+
- name: Upload Artifact - dotfiles
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: dotfiles-disk
74+
path: |
75+
./output/qcow2/almalinux-disk.qcow2
76+
retention-days: 5

.github/workflows/build-diskimages-release.yml

+34-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ jobs:
4444
- name: Create shared user configuration
4545
run: touch config.toml
4646

47-
- name: Build image - fedora
47+
48+
- name: Build image - Fedora
4849
id: build-image-fedora
4950
run: |
5051
mkdir -p ./output
@@ -67,10 +68,11 @@ jobs:
6768
env:
6869
IMAGE_NAME: ghcr.io/gbraad-dotfiles/fedora-bootc:latest
6970

70-
- name: Rename output file - dotfiles
71+
- name: Rename output file - Fedora
7172
run: sudo mv ./output/qcow2/disk.qcow2 ./output/qcow2/fedora-disk.qcow2
7273

73-
- name: Build image - centos
74+
75+
- name: Build image - CentOS
7476
id: build-image-centos
7577
run: |
7678
mkdir -p ./output
@@ -93,9 +95,37 @@ jobs:
9395
env:
9496
IMAGE_NAME: ghcr.io/gbraad-dotfiles/centos-bootc:latest
9597

96-
- name: Rename output file - dotfiles
98+
- name: Rename output file - CentOS
9799
run: sudo mv ./output/qcow2/disk.qcow2 ./output/qcow2/centos-disk.qcow2
98100

101+
102+
- name: Build image - AlmaLinux
103+
id: build-image-almalinux
104+
run: |
105+
mkdir -p ./output
106+
sudo podman pull ${{ env.IMAGE_NAME }}
107+
sudo podman run \
108+
--rm \
109+
-it \
110+
--privileged \
111+
--pull=newer \
112+
--security-opt label=type:unconfined_t \
113+
-v ./config.toml:/config.toml:ro \
114+
-v ./output:/output \
115+
-v /var/lib/containers/storage:/var/lib/containers/storage \
116+
${{ env.BIB_IMAGE }} \
117+
--target-arch ${{ env.ARCH }} \
118+
--type ${{ env.DISK_TYPE }} \
119+
--rootfs ${{ env.ROOTFS }} \
120+
--local \
121+
${{ env.IMAGE_NAME }}
122+
env:
123+
IMAGE_NAME: ghcr.io/gbraad-dotfiles/almalinux-bootc:latest
124+
125+
- name: Rename output file - AlmaLinux
126+
run: sudo mv ./output/qcow2/disk.qcow2 ./output/qcow2/almalinux-disk.qcow2
127+
128+
99129
- name: Set release tag
100130
run: echo "TAG=$(date +'%y%m%d')" >> $GITHUB_ENV
101131

0 commit comments

Comments
 (0)