Skip to content

Commit

Permalink
Merge pull request #47 from iterait/aarch64
Browse files Browse the repository at this point in the history
Add arch64 build
  • Loading branch information
petrbel authored Jan 7, 2022
2 parents 8f0e5c3 + 6cc3e76 commit 89d813d
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 20 deletions.
101 changes: 101 additions & 0 deletions dockerfiles/archlinuxarm/Dockerfile.archlinuxaarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM scratch
LABEL thanksto "archimg/archlinux"
LABEL maintainer "Iterait a.s. <docker@iterait.com>"

# add image content
ADD arch-rootfs/ /
ADD 99-cleanup.hook /usr/share/libalpm/hooks/

# add keyring
RUN pacman-key --init && \
pacman-key --populate archlinuxarm

# install base & remove useless stuff
RUN pacman --noconfirm -Syu --needed \
base \
binutils \
fakeroot \
git \
sudo \
&& pacman --noconfirm -Rs \
dhcpcd \
nano \
netctl \
openresolv \
vi \
haveged \
net-tools \
openssh \
&& rm -rf /README

# set UTF-8 locale
RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && locale-gen
RUN echo 'LANG=en_US.UTF-8' > /etc/locale.conf
ENV LANG en_US.UTF-8

# setup user `aur`
RUN useradd -m -s /bin/bash aur \
&& passwd -d aur \
&& echo 'aur ALL=(ALL) ALL' > /etc/sudoers.d/aur \
&& echo 'Defaults env_keep += "EDITOR"' >> /etc/sudoers.d/aur


# remove all unnecessary packages
RUN pacman --noconfirm -R \
git \
argon2 \
base \
binutils \
cryptsetup \
db \
dbus \
device-mapper \
diffutils \
elfutils \
fakeroot \
file \
gawk \
gdbm \
gettext \
grep \
hwids \
icu \
iproute2 \
iptables \
iputils \
json-c \
kbd \
kmod \
libcroco \
libelf \
libmnl \
libnetfilter_conntrack \
libnfnetlink \
libnftnl \
libnl \
libpcap \
libseccomp \
libxml2 \
licenses \
linux-aarch64 \
linux-firmware \
mkinitcpio \
mkinitcpio-busybox \
mpfr \
pciutils \
perl \
perl-error \
perl-mailtools \
perl-timedate \
popt \
procps-ng \
psmisc \
shadow \
sudo \
systemd \
systemd-sysvcompat \
tar \
util-linux \
which

CMD ["/bin/bash"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM iterait/archlinuxarm
ARG BASE_IMAGE
FROM iterait/${BASE_IMAGE}
LABEL thanksto "archimg/archlinux"
LABEL maintainer "Iterait a.s. <docker@iterait.com>"

Expand Down
6 changes: 6 additions & 0 deletions dockerfiles/archlinuxarm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ ArchLinux ARM Docker Image

Based on [archimg/archlinux](https://github.com/archimg/archlinux).

Prerequisites (Arch Linux)
===
```
sudo pacman -S qemu-headless qemu-headless-arch-extra docker
```

Build
=====

Expand Down
48 changes: 29 additions & 19 deletions dockerfiles/archlinuxarm/build.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
#!/bin/bash -ex

[ $UID -ne 0 ] && echo "This script should get executed as root. Otherwise file special permissions are not set correctly." >&2

URL="http://os.archlinuxarm.org/os"
IMAGE_TAR="ArchLinuxARM-rpi-2-latest.tar.gz"
TODAY="$(date '+%Y-%m-%d')"
URL="http://os.archlinuxarm.org/os"

for imagename in archlinuxaarch64 archlinuxarm; do

if [ "${imagename}" = "archlinuxarm" ]; then
IMAGE_TAR="ArchLinuxARM-rpi-2-latest.tar.gz"
elif [ "${imagename}" = "archlinuxaarch64" ]; then
IMAGE_TAR="ArchLinuxARM-aarch64-latest.tar.gz"
else
echo "Not suppoorted arm image type."
exit 1
fi

# Download and unpack the base system tarball from archlinuxarm.org.
rm -rf "${IMAGE_TAR}" arch-rootfs
wget "${URL}/${IMAGE_TAR}"
mkdir -p arch-rootfs
tar -xzf ${IMAGE_TAR} --strip-components=1 --directory=./arch-rootfs
# Download and unpack the base system tarball from archlinuxarm.org.
rm -rf "${IMAGE_TAR}" arch-rootfs
wget "${URL}/${IMAGE_TAR}"
mkdir -p arch-rootfs
tar -xzf ${IMAGE_TAR} --strip-components=1 --directory=./arch-rootfs

# Copy libalpm hooks to our future build context
cp ../*.hook ./
# Copy libalpm hooks to our future build context
cp ../*.hook ./

# Build the base image.
docker build -f Dockerfile.archlinuxarm --rm --no-cache -t "iterait/archlinuxarm:${TODAY}" -t "iterait/archlinuxarm:latest" --squash .
# Build the -dev version without context.
docker build - --rm --no-cache -t "iterait/archlinuxarm-dev:${TODAY}" -t "iterait/archlinuxarm-dev:latest" < Dockerfile.archlinuxarm-dev
# Build the base image.
docker build -f Dockerfile.${imagename} --rm --no-cache -t "iterait/${imagename}:${TODAY}" -t "iterait/${imagename}:latest" --squash .
# Build the -dev version without context.
docker build - --build-arg BASE_IMAGE=${imagename} --rm --no-cache -t "iterait/${imagename}-dev:${TODAY}" -t "iterait/${imagename}-dev:latest" < Dockerfile.dev

# Push the images to the repository.
docker push iterait/archlinuxarm:latest
docker push iterait/archlinuxarm:${TODAY}
docker push iterait/archlinuxarm-dev:latest
docker push iterait/archlinuxarm-dev:${TODAY}
# Push the images to the repository.
docker push iterait/${imagename}:latest
docker push iterait/${imagename}:${TODAY}
docker push iterait/${imagename}-dev:latest
docker push iterait/${imagename}-dev:${TODAY}
done

0 comments on commit 89d813d

Please sign in to comment.