builder-archlinux/Dockerfile

84 lines
3.7 KiB
Docker

# SPDX-FileCopyrightText: 2023 - 2024 Daniel Wolf <nephatrine@gmail.com>
#
# SPDX-License-Identifier: ISC
# hadolint ignore=DL3007
FROM archlinux:latest
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
#RUN pacman -Sy --noconfirm --needed reflector \
# && reflector -l 200 -p https --sort rate --save /etc/pacman.d/mirrorlist.reflector \
# && mv /etc/pacman.d/mirrorlist.reflector /etc/pacman.d/mirrorlist \
# hadolint ignore=DL4006,SC2046
RUN pacman -Syu --noconfirm \
&& pacman-db-upgrade \
&& for file in $(find /etc -name '*.pacnew'); do mv -vf "${file}" "$(echo ${file} | sed 's/\.pacnew//g')"; done \
&& sed -i 's/^#en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen && locale-gen \
&& printf "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf \
&& pacman -Sy --noconfirm --needed \
bash bzip2 ca-certificates curl file gawk git git-lfs jq libarchive \
lsb-release make npm p7zip patch subversion sudo unzip wget which xz zip \
&& if [ -n "$(pacman -Qtdq)" ]; then pacman -Rns --noconfirm $(pacman -Qtdq); fi \
&& pacman -Scc --noconfirm \
&& useradd -u 1337 -g users -d /home/builder -s /bin/bash builder \
&& mkdir -p /home/builder \
&& chown -R builder:users /home/builder \
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/builder \
&& rm -rf /tmp/* /var/tmp/*
# hadolint ignore=SC2046
RUN pacman -Sy --noconfirm --needed \
autoconf automake binutils bison clang cmake debugedit fakeroot flex gcc \
lib32-gcc-libs libtool nasm ninja pkgconf texinfo \
&& pacman -Sy --noconfirm --needed \
icu lib32-curl lib32-icu lib32-libxml2 lib32-openssl lib32-zlib lib32-zstd \
libxml2 openssl zlib zstd \
&& if [ -n "$(pacman -Qtdq)" ]; then pacman -Rns --noconfirm $(pacman -Qtdq); fi \
&& pacman -Scc --noconfirm \
&& rm -rf /tmp/* /var/tmp/*
ENV PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin
# hadolint ignore=DL3013,SC2046
RUN pacman -Sy --noconfirm --needed python-pipx reuse \
&& if [ -n "$(pacman -Qtdq)" ]; then pacman -Rns --noconfirm $(pacman -Qtdq); fi \
&& pacman -Scc --noconfirm \
&& pipx install cmakelang \
&& rm -rf /tmp/* /var/tmp/*
ENV CGO_ENABLED=1 CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOPATH=/go
# hadolint ignore=SC2046
RUN pacman -Sy --noconfirm --needed go \
&& if [ -n "$(pacman -Qtdq)" ]; then pacman -Rns --noconfirm $(pacman -Qtdq); fi \
&& pacman -Scc --noconfirm \
&& go install github.com/mdomke/git-semver/v6@latest \
&& rm -rf /tmp/* /var/tmp/*
ENV PATH ${GOPATH}/bin:$PATH
# hadolint ignore=SC2046
RUN pacman -Sy --noconfirm --needed \
doxygen graphviz imagemagick librsvg python-jinja python-pygments \
texlive-core \
&& if [ -n "$(pacman -Qtdq)" ]; then pacman -Rns --noconfirm $(pacman -Qtdq); fi \
&& pacman -Scc --noconfirm \
&& git -C "${HOME}" clone --single-branch --depth=1 https://github.com/mosra/m.css \
&& rm -rf "${HOME}"/m.css/documentation/test* \
&& mkdir /opt/m.css \
&& mv "${HOME}/m.css/documentation" /opt/m.css/bin && mv "${HOME}/m.css/COPYING" /opt/m.css/ \
&& mv "${HOME}/m.css/css" /opt/m.css/css && mv "${HOME}/m.css/plugins" /opt/m.css/plugins \
&& su - builder -c "git -C /tmp clone --single-branch --depth=1 https://aur.archlinux.org/mscgen.git" \
&& su - builder -c "cd /tmp/mscgen; makepkg --noconfirm --syncdeps --rmdeps --install --clean" \
&& rm -rf /tmp/* /var/tmp/* "${HOME}/m.css"
ENV PATH=/opt/m.css/bin:$PATH
COPY override /
# hadolint ignore=DL3003
RUN git -C "${HOME}" clone --single-branch --depth=1 https://code.nephatrine.net/nephatrine/hello-test.git \
&& mkdir /tmp/build-x86_64 && cd /tmp/build-x86_64 \
&& nxbuild-linux-x86_64 -GNinja "${HOME}/hello-test" \
&& ninja && ninja test \
&& mkdir /tmp/build-i686 && cd /tmp/build-i686 \
&& nxbuild-linux-i686 -GNinja "${HOME}/hello-test" \
&& ninja && ninja test \
&& cd .. && rm -rf /tmp/* /var/tmp/* "${HOME}/hello-test"