-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement Dockerfile and restructure * .github: update workflows to use docker registry * implement utilities to use for local development * add output folder This fixes permission issues when docker makes the container and creating any file with a runner will fail. * small fixes
- Loading branch information
1 parent
dc92422
commit 381026f
Showing
18 changed files
with
254 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build docker container | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
build: | ||
name: Build base docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*.SRCINFO | ||
*.img.tar.xz | ||
output/* | ||
aur-pkgs/* | ||
!aur-pkgs/build-aur-packages.sh | ||
!aur-pkgs/build-aur-package.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,47 @@ | ||
FROM archlinux:base-devel | ||
LABEL contributor="shadowapex@gmail.com" | ||
RUN sed -i '/ParallelDownloads/s/^#//g' /etc/pacman.conf && \ | ||
echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf && \ | ||
echo -e "keyserver-options auto-key-retrieve" >> /etc/pacman.d/gnupg/gpg.conf && \ | ||
pacman --noconfirm -Syyuu && \ | ||
pacman --noconfirm -S \ | ||
arch-install-scripts \ | ||
btrfs-progs \ | ||
fmt \ | ||
xcb-util-wm \ | ||
wget \ | ||
pyalpm \ | ||
python-build \ | ||
python-installer \ | ||
python-markdown-it-py \ | ||
python-setuptools \ | ||
python-wheel \ | ||
sudo \ | ||
reflector \ | ||
&& \ | ||
pacman --noconfirm -S --needed git && \ | ||
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ | ||
useradd build -G wheel -m && \ | ||
su - build -c "git clone https://aur.archlinux.org/pikaur.git /tmp/pikaur" && \ | ||
su - build -c "cd /tmp/pikaur && makepkg -f" && \ | ||
pacman --noconfirm -U /tmp/pikaur/pikaur-*.pkg.tar.zst | ||
|
||
# Freeze if required | ||
COPY freeze.sh own-pkg.sh manifest / | ||
COPY pkgs /pkgs | ||
# Add a fake systemd-run script to workaround pikaur requirement. | ||
RUN echo -e "#!/bin/bash\nif [[ \"$1\" == \"--version\" ]]; then echo 'fake 244 version'; fi\nmkdir -p /var/cache/pikaur\n" >> /usr/bin/systemd-run && \ | ||
chmod +x /usr/bin/systemd-run | ||
|
||
RUN chmod +x freeze.sh && ./freeze.sh | ||
# Build pikaur packages as the 'build' user | ||
ENV BUILD_USER "build" | ||
COPY manifest /manifest | ||
# Freeze packages and overwrite with overrides when needed | ||
RUN source /manifest; if [ -n "${ARCHIVE_DATE}" ]; then echo "Server=https://archive.archlinux.org/repos/${ARCHIVE_DATE}/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist; else reflector --verbose --latest 10 --protocol https --sort rate --save /etc/pacman.d/mirrorlist; fi && \ | ||
pacman --noconfirm -Syyuu; if [ -n "${PACKAGE_OVERRIDES}" ]; then wget --directory-prefix=/tmp/extra_pkgs ${PACKAGE_OVERRIDES}; pacman --noconfirm -U --overwrite '*' /tmp/extra_pkgs/*; fi | ||
|
||
USER build | ||
ENV BUILD_USER "build" | ||
ENV GNUPGHOME "/etc/pacman.d/gnupg" | ||
RUN chmod +x own-pkg.sh && ./own-pkg.sh | ||
|
||
# Built image will be moved here. This should be a host mount to get the output. | ||
ENV OUTPUT_DIR /output | ||
|
||
WORKDIR /workdir | ||
ENTRYPOINT ["/workdir/build.sh"] | ||
COPY pkgs /packages | ||
RUN /packages/build-packages.sh | ||
|
||
WORKDIR /workdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
source manifest; | ||
|
||
sudo mkdir -p /workdir/aur-pkgs | ||
sudo chown build:build /workdir/aur-pkgs | ||
|
||
PIKAUR_CMD="PKGDEST=/workdir/aur-pkgs pikaur --noconfirm -Sw ${1}" | ||
PIKAUR_RUN=(bash -c "${PIKAUR_CMD}") | ||
"${PIKAUR_RUN[@]}" | ||
# remove any epoch (:) in name, replace with -- since not allowed in artifacts | ||
find /workdir/aur-pkgs/*.pkg.tar* -type f -name '*:*' -execdir bash -c 'mv "$1" "${1//:/--}"' bash {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
source manifest; | ||
|
||
sudo mkdir -p /workdir/aur-pkgs | ||
sudo chown build:build /workdir/aur-pkgs | ||
|
||
PIKAUR_CMD="PKGDEST=/workdir/aur-pkgs pikaur --noconfirm -Sw ${AUR_PACKAGES}" | ||
PIKAUR_RUN=(bash -c "${PIKAUR_CMD}") | ||
"${PIKAUR_RUN[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.