diff --git a/dockerfiles/archlinuxarm/Dockerfile.archlinuxaarch64 b/dockerfiles/archlinuxarm/Dockerfile.archlinuxaarch64 new file mode 100644 index 0000000..4e83539 --- /dev/null +++ b/dockerfiles/archlinuxarm/Dockerfile.archlinuxaarch64 @@ -0,0 +1,101 @@ +FROM scratch +LABEL thanksto "archimg/archlinux" +LABEL maintainer "Iterait a.s. " + +# 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"] diff --git a/dockerfiles/archlinuxarm/Dockerfile.archlinuxarm-dev b/dockerfiles/archlinuxarm/Dockerfile.dev similarity index 89% rename from dockerfiles/archlinuxarm/Dockerfile.archlinuxarm-dev rename to dockerfiles/archlinuxarm/Dockerfile.dev index 384e2ef..5eb8736 100644 --- a/dockerfiles/archlinuxarm/Dockerfile.archlinuxarm-dev +++ b/dockerfiles/archlinuxarm/Dockerfile.dev @@ -1,4 +1,5 @@ -FROM iterait/archlinuxarm +ARG BASE_IMAGE +FROM iterait/${BASE_IMAGE} LABEL thanksto "archimg/archlinux" LABEL maintainer "Iterait a.s. " diff --git a/dockerfiles/archlinuxarm/README.md b/dockerfiles/archlinuxarm/README.md index a449d84..c081768 100644 --- a/dockerfiles/archlinuxarm/README.md +++ b/dockerfiles/archlinuxarm/README.md @@ -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 ===== diff --git a/dockerfiles/archlinuxarm/build.sh b/dockerfiles/archlinuxarm/build.sh index 3c810a9..41dd34f 100755 --- a/dockerfiles/archlinuxarm/build.sh +++ b/dockerfiles/archlinuxarm/build.sh @@ -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