Skip to content

Commit e1bb080

Browse files
committed
initial commit
0 parents  commit e1bb080

File tree

5 files changed

+163
-0
lines changed

5 files changed

+163
-0
lines changed

.github/workflows/build.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build container image
2+
on:
3+
schedule:
4+
- cron: '5 10 1 * *' # 10:05am UTC 1st day of every month
5+
push:
6+
branches:
7+
- master
8+
paths-ignore:
9+
- '**/README.md'
10+
workflow_dispatch:
11+
12+
env:
13+
IMAGE_DESC: "Arch Linux (Botany Distrobox)"
14+
IMAGE_LOGO_URL: "https://botany.pl/images/Layout/logo.svg"
15+
IMAGE_NAME: "${{ github.event.repository.name }}"
16+
DEFAULT_TAG: "latest"
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ inputs.brand_name}}-${{ inputs.stream_name }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build_push:
24+
name: Build and push image
25+
runs-on: ubuntu-24.04
26+
27+
permissions:
28+
contents: read
29+
packages: write
30+
id-token: write
31+
32+
steps:
33+
- name: Prepare environment
34+
run: |
35+
# Lowercase the image uri
36+
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
37+
38+
- name: Checkout
39+
uses: actions/checkout@v6
40+
41+
- name: Get current date
42+
id: date
43+
run: |
44+
# This generates a timestamp like what is defined on the ArtifactHub documentation
45+
# E.G: 2022-02-08T15:38:15Z'
46+
# https://artifacthub.io/docs/topics/repositories/container-images/
47+
# https://linux.die.net/man/1/date
48+
echo "date=$(date -u +%Y\-%m\-%d\T%H\:%M\:%S\Z)" >> $GITHUB_OUTPUT
49+
echo "date_short=$(date -u +%Y%m%d)" >> $GITHUB_OUTPUT
50+
51+
# Image metadata for https://artifacthub.io/ - This is optional but is highly recommended so we all can get a index of all the custom images
52+
# The metadata by itself is not going to do anything, you choose if you want your image to be on ArtifactHub or not.
53+
- name: Image Metadata
54+
uses: docker/metadata-action@v5
55+
id: metadata
56+
with:
57+
# This generates all the tags for your image, you can add custom tags here too!
58+
# Default tags are "$DEFAULT_TAG" and "$DEFAULT_TAG.$date".
59+
tags: |
60+
type=raw,value=${{ env.DEFAULT_TAG }}
61+
labels: |
62+
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}/refs/heads/main/README.md
63+
org.opencontainers.image.created=${{ steps.date.outputs.date }}
64+
org.opencontainers.image.description=${{ env.IMAGE_DESC }}
65+
org.opencontainers.image.documentation=https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}/refs/heads/main/README.md
66+
org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}/blob/main/Containerfile
67+
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
68+
org.opencontainers.image.url=https://github.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
69+
org.opencontainers.image.vendor=${{ github.repository_owner }}
70+
org.opencontainers.image.version=${{ env.DEFAULT_TAG }}.{{date 'YYYYMMDD'}}
71+
org.opencontainers.image.revision=${{ github.sha }}
72+
io.artifacthub.package.deprecated=false
73+
io.artifacthub.package.logo-url=${{ env.IMAGE_LOGO_URL }}
74+
io.artifacthub.package.prerelease=false
75+
sep-tags: " "
76+
sep-annotations: " "
77+
78+
- name: Build Image
79+
id: build_image
80+
uses: redhat-actions/buildah-build@v2
81+
with:
82+
containerfiles: |
83+
./Containerfile
84+
image: ${{ env.IMAGE_NAME }}
85+
tags: ${{ steps.metadata.outputs.tags }}
86+
labels: ${{ steps.metadata.outputs.labels }}
87+
oci: true
88+
extra-args: |
89+
--security-opt=seccomp=unconfined
90+
91+
- name: Push to private registry
92+
uses: redhat-actions/push-to-registry@v2
93+
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
94+
env:
95+
REGISTRY_USER: ${{ github.actor }}
96+
REGISTRY_PASSWORD: ${{ github.token }}
97+
with:
98+
registry: ${{ secrets.IMAGE_REGISTRY }}
99+
image: ${{ env.IMAGE_NAME }}
100+
tags: ${{ steps.metadata.outputs.tags }}
101+
username: ${{ secrets.REGISTRY_USER }}
102+
password: ${{ secrets.REGISTRY_PASSWORD }}
103+
extra-args: |
104+
--disable-content-trust
105+
--compression-format=zstd:chunked
106+
--force-compression=true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Containerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Allow build scripts to be referenced without being copied into the final image
2+
FROM scratch AS ctx
3+
COPY setup.sh /
4+
5+
FROM ghcr.io/ublue-os/arch-toolbox:latest AS arch-toolbox
6+
7+
LABEL com.github.containers.toolbox="true" \
8+
usage="This image is meant to be used with the toolbox or distrobox command" \
9+
summary="A cloud-native terminal experience powered by Arch Linux"
10+
11+
RUN --mount=type=bind,from=ctx,source=/,target=/ctx /ctx/setup.sh

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# arch-linux-distrobox

setup.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
sed -i 's@#pl_PL.UTF-8@pl_PL.UTF-8@g' /etc/locale.gen
4+
locale-gen
5+
6+
sed -i '1s/^/Server = https://ftp.icm.edu.pl/pub/Linux/dist/archlinux/$repo/os/$arch\n/' /etc/pacman.d/mirrorlist
7+
sed -i '1s/^/Server = https://ftp.psnc.pl/linux/archlinux/$repo/os/$arch\n/' /etc/pacman.d/mirrorlist
8+
echo 'Server = https://archive.archlinux.org/.all' >> /etc/pacman.d/mirrorlist
9+
10+
pacman-key --init
11+
pacman-key --populate
12+
13+
# BioArchLinux
14+
pacman-key --recv-keys B1F96021DB62254D
15+
pacman-key --finger B1F96021DB62254D
16+
pacman-key --lsign-key B1F96021DB62254D
17+
tee -a /etc/pacman.conf <<<'EOF'
18+
[bioarchlinux]
19+
Server = https://repo.bioarchlinux.org/$arch
20+
EOF
21+
22+
# Chaotic AUR
23+
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
24+
pacman-key --lsign-key 3056513887B78AEB
25+
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst'
26+
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
27+
tee -a /etc/pacman.conf <<<'EOF'
28+
[chaotic-aur]
29+
Include = /etc/pacman.d/chaotic-mirrorlist
30+
EOF
31+
32+
# Arch4Edu
33+
pacman-key --recv-keys 7931B6D628C8D3BA
34+
pacman-key --finger 7931B6D628C8D3BA
35+
pacman-key --lsign-key 7931B6D628C8D3BA
36+
curl --retry 3 -sSLo /etc/pacman.d/mirrorlist.arch4edu https://raw.githubusercontent.com/arch4edu/mirrorlist/refs/heads/master/mirrorlist.arch4edu
37+
tee -a /etc/pacman.conf <<<'EOF'
38+
[arch4edu]
39+
Include = /etc/pacman.d/mirrorlist.arch4edu
40+
EOF
41+
42+
pacman -Syu --noconfirm bioarchlinux-keyring arch4edu-keyring mirrorlist.arch4edu pkgstats
43+
pacman -Scc
44+
rm -rf /var/cache/pacman/pkg/*

0 commit comments

Comments
 (0)