Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arch64 build #47

Merged
merged 3 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions dockerfiles/archlinuxarm/Dockerfile.archlinuxaarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
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 \
petrbel marked this conversation as resolved.
Show resolved Hide resolved
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

# install `yay`
RUN git clone https://aur.archlinux.org/yay-bin.git \
&& chown -R aur:aur /yay-bin \
&& cd /yay-bin \
&& sudo -u aur makepkg -si --needed --noconfirm \
&& cd / \
&& rm -rf /yay-bin

# configure `yay` to remove build cache and make dependencies
RUN sudo -u aur yay --cleanafter --removemake --save

# remove all unnecessary packages
RUN pacman --noconfirm -R \
yay-bin \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huu why don't you install it in the previous command? I think we want to keep it

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
50 changes: 31 additions & 19 deletions dockerfiles/archlinuxarm/build.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
#!/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"
cp /usr/bin/qemu-arm-static qemu-arm-static
elif [ "${imagename}" = "archlinuxaarch64" ]; then
IMAGE_TAR="ArchLinuxARM-aarch64-latest.tar.gz"
cp /usr/bin/qemu-aarch64-static qemu-arm-static
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