feat: add arch imag
ci/woodpecker/push/arch-docker Pipeline failed Details

main
Jef Roosens 2023-02-16 14:33:39 +01:00
parent e4d3efb47f
commit d5c3194587
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
8 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,23 @@
platform: 'linux/amd64'
when:
- path:
- 'arch/Dockerfile'
- '.woodpecker/arch-docker.yml'
event: [push]
- event: [cron]
pipeline:
build:
image: 'woodpeckerci/plugin-docker-buildx'
secrets:
- 'docker_username'
- 'docker_password'
settings:
registry: 'git.rustybever.be'
repo: 'git.rustybever.be/vieter-v/vieter-builder'
tags:
- 'latest'
platforms: [ 'linux/arm64/v8', 'linux/amd64' ]
mtu: 1300
context: 'arch'

View File

@ -35,3 +35,11 @@ docker buildx build \
This build requires a working buildx environment.
The hash in the tag corresponds to the tag of the vlang repository.
## Arch
The Arch builder image is a soft fork of
[Menci/docker-archlinuxarm](https://github.com/Menci/docker-archlinuxarm), with
the following minimal changes:
* Enable LTO by default

42
arch/Dockerfile 100644
View File

@ -0,0 +1,42 @@
FROM alpine:3.15 AS bootstrapper
ARG TARGETARCH
COPY files /files
RUN \
apk add arch-install-scripts pacman-makepkg curl && \
cat /files/repos-$TARGETARCH >> /etc/pacman.conf && \
mkdir -p /etc/pacman.d && \
cp /files/mirrorlist-$TARGETARCH /etc/pacman.d/mirrorlist && \
BOOTSTRAP_EXTRA_PACKAGES="" && \
if [[ "$TARGETARCH" == "amd64" ]]; then \
apk add zstd && \
mkdir /tmp/archlinux-keyring && \
curl -L https://archlinux.org/packages/core/any/archlinux-keyring/download | unzstd | tar -C /tmp/archlinux-keyring -xv && \
mv /tmp/archlinux-keyring/usr/share/pacman/keyrings /usr/share/pacman/; \
elif [[ "$TARGETARCH" == "arm64" ]]; then \
curl -L https://github.com/archlinuxarm/archlinuxarm-keyring/archive/refs/heads/master.zip | unzip -d /tmp/archlinuxarm-keyring - && \
mkdir /usr/share/pacman/keyrings && \
mv /tmp/archlinuxarm-keyring/*/archlinuxarm* /usr/share/pacman/keyrings/ && \
BOOTSTRAP_EXTRA_PACKAGES="archlinuxarm-keyring"; \
fi && \
pacman-key --init && \
pacman-key --populate && \
mkdir /rootfs && \
/files/pacstrap-docker /rootfs base-devel $BOOTSTRAP_EXTRA_PACKAGES && \
cp /etc/pacman.d/mirrorlist /rootfs/etc/pacman.d/mirrorlist && \
echo "en_US.UTF-8 UTF-8" > /rootfs/etc/locale.gen && \
echo "LANG=en_US.UTF-8" > /rootfs/etc/locale.conf && \
chroot /rootfs locale-gen && \
rm -rf /rootfs/var/lib/pacman/sync/* /rootfs/files
FROM scratch
COPY --from=bootstrapper /rootfs/ /
ENV LANG=en_US.UTF-8
RUN \
ln -sf /usr/lib/os-release /etc/os-release && \
pacman-key --init && \
pacman-key --populate && \
rm -rf /etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}* && \
# Enable LTO by default \
sed -i 's/!lto/lto/' /etc/makepkg.conf
CMD ["/usr/bin/bash"]

View File

@ -0,0 +1 @@
Server = http://mirrors.xtom.com/archlinux/$repo/os/$arch

View File

@ -0,0 +1 @@
Server = http://mirror.archlinuxarm.org/$arch/$repo

View File

@ -0,0 +1,31 @@
#!/bin/bash
out() { printf "$1 $2\n" "${@:3}"; }
error() { out "==> ERROR:" "$@"; } >&2
die() { error "$@"; exit 1; }
(( $# )) || die "No root directory specified"
newroot=$1; shift
pacman_args=("${@:-base}")
if [[ $EUID -ne 0 ]]; then
die "This script must be run as root"
fi
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
echo 'Creating install root at %s' "$newroot"
mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc}
mkdir -m 1777 -p "$newroot"/tmp
mkdir -m 0555 -p "$newroot"/{sys,proc}
echo 'Creating /dev/null in new root'
mknod "$newroot/dev/null" c 1 3
echo 'Installing packages to %s' "$newroot"
if ! pacman -r "$newroot" -Sy --noconfirm "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi
echo 'Deleting /dev/null from new root'
rm "$newroot/dev/null"

View File

@ -0,0 +1,8 @@
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist

View File

@ -0,0 +1,14 @@
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
[alarm]
Include = /etc/pacman.d/mirrorlist
[aur]
Include = /etc/pacman.d/mirrorlist