mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-05-07 08:24:03 +00:00
build: use build_date argument for docker image instead of guessing from pacman root
This commit is contained in:
@@ -26,6 +26,10 @@ jobs:
|
|||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Set image date
|
||||||
|
id: args
|
||||||
|
run: echo "::set-output name=date::$(date -d yesterday +'%Y-%m-%d')"
|
||||||
|
|
||||||
- name: Login to docker hub
|
- name: Login to docker hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -53,6 +57,8 @@ jobs:
|
|||||||
- name: Build an image and push
|
- name: Build an image and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
build-args: |
|
||||||
|
BUILD_DATE=${{ steps.args.outputs.date }}
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
|||||||
+11
-12
@@ -1,13 +1,15 @@
|
|||||||
# build image
|
# build image
|
||||||
FROM archlinux:base AS build
|
FROM archlinux:base AS build
|
||||||
|
|
||||||
|
ARG BUILD_DATE
|
||||||
|
|
||||||
# install environment
|
# install environment
|
||||||
## create build user
|
## create build user
|
||||||
RUN useradd -m -d "/home/build" -s "/usr/bin/nologin" build
|
RUN useradd -m -d "/home/build" -s "/usr/bin/nologin" build
|
||||||
|
|
||||||
## extract container creation date and set mirror for this timestamp, set PKGEXT and refresh database next
|
## extract container creation date and set mirror for this timestamp, set PKGEXT and refresh database next
|
||||||
RUN echo "Server = https://archive.archlinux.org/repos/$(stat -c "%y" "/var/lib/pacman" | cut -d " " -f 1 | sed "s,-,/,g")/\$repo/os/\$arch" > "/etc/pacman.d/mirrorlist" && \
|
RUN echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE//-/\/}/\$repo/os/\$arch" > "/etc/pacman.d/mirrorlist" && \
|
||||||
pacman -Sy
|
pacman -Syyuu --noconfirm
|
||||||
## setup package cache
|
## setup package cache
|
||||||
RUN runuser -u build -- mkdir "/tmp/pkg" && \
|
RUN runuser -u build -- mkdir "/tmp/pkg" && \
|
||||||
echo "PKGDEST=/tmp/pkg" >> "/etc/makepkg.conf" && \
|
echo "PKGDEST=/tmp/pkg" >> "/etc/makepkg.conf" && \
|
||||||
@@ -29,17 +31,15 @@ RUN pacman -S --noconfirm --asdeps \
|
|||||||
python-filelock \
|
python-filelock \
|
||||||
python-inflection \
|
python-inflection \
|
||||||
python-pyelftools \
|
python-pyelftools \
|
||||||
python-requests \
|
python-requests
|
||||||
&& \
|
RUN pacman -S --noconfirm --asdeps \
|
||||||
pacman -S --noconfirm --asdeps \
|
|
||||||
base-devel \
|
base-devel \
|
||||||
python-build \
|
python-build \
|
||||||
python-flit \
|
python-flit \
|
||||||
python-installer \
|
python-installer \
|
||||||
python-tox \
|
python-tox \
|
||||||
python-wheel \
|
python-wheel
|
||||||
&& \
|
RUN pacman -S --noconfirm --asdeps \
|
||||||
pacman -S --noconfirm --asdeps \
|
|
||||||
git \
|
git \
|
||||||
python-aiohttp \
|
python-aiohttp \
|
||||||
python-aiohttp-openmetrics \
|
python-aiohttp-openmetrics \
|
||||||
@@ -48,9 +48,8 @@ RUN pacman -S --noconfirm --asdeps \
|
|||||||
python-cryptography \
|
python-cryptography \
|
||||||
python-jinja \
|
python-jinja \
|
||||||
python-systemd \
|
python-systemd \
|
||||||
rsync \
|
rsync
|
||||||
&& \
|
RUN runuser -u build -- install-aur-package \
|
||||||
runuser -u build -- install-aur-package \
|
|
||||||
python-aioauth-client \
|
python-aioauth-client \
|
||||||
python-sphinx-typlog-theme \
|
python-sphinx-typlog-theme \
|
||||||
python-webargs \
|
python-webargs \
|
||||||
@@ -109,7 +108,7 @@ RUN cp "/etc/pacman.d/mirrorlist" "/etc/pacman.d/mirrorlist.orig" && \
|
|||||||
echo "Server = file:///var/cache/pacman/pkg" > "/etc/pacman.d/mirrorlist" && \
|
echo "Server = file:///var/cache/pacman/pkg" > "/etc/pacman.d/mirrorlist" && \
|
||||||
cp "/etc/pacman.conf" "/etc/pacman.conf.orig" && \
|
cp "/etc/pacman.conf" "/etc/pacman.conf.orig" && \
|
||||||
sed -i "s/SigLevel *=.*/SigLevel = Optional/g" "/etc/pacman.conf" && \
|
sed -i "s/SigLevel *=.*/SigLevel = Optional/g" "/etc/pacman.conf" && \
|
||||||
pacman -Sy
|
pacman -Syyuu --noconfirm
|
||||||
## install package and its optional dependencies
|
## install package and its optional dependencies
|
||||||
RUN pacman -S --noconfirm ahriman
|
RUN pacman -S --noconfirm ahriman
|
||||||
RUN pacman -S --noconfirm --asdeps \
|
RUN pacman -S --noconfirm --asdeps \
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ for PACKAGE in "$@"; do
|
|||||||
# clone the remote source
|
# clone the remote source
|
||||||
git clone https://aur.archlinux.org/"$PACKAGE".git "$BUILD_DIR"
|
git clone https://aur.archlinux.org/"$PACKAGE".git "$BUILD_DIR"
|
||||||
cd "$BUILD_DIR"
|
cd "$BUILD_DIR"
|
||||||
|
# FIXME monkey patch PKGBUILD for python
|
||||||
|
sed -i 's/python -m build/python -m build --skip-dependency-check/g' "PKGBUILD"
|
||||||
# checkout to the image date
|
# checkout to the image date
|
||||||
git checkout "$(git rev-list -1 --before="$(stat -c "%y" "/var/lib/pacman" | cut -d " " -f 1)" master)"
|
git checkout "$(git rev-list -1 --before="$BUILD_DATE" master)"
|
||||||
# build and install the package
|
# build and install the package
|
||||||
makepkg --nocheck --noconfirm --install --rmdeps --syncdeps
|
makepkg --nocheck --noconfirm --install --rmdeps --syncdeps
|
||||||
cd /
|
cd /
|
||||||
|
|||||||
Reference in New Issue
Block a user