65 lines
2.7 KiB
Docker
65 lines
2.7 KiB
Docker
# SPDX-FileCopyrightText: 2023 - 2024 Daniel Wolf <nephatrine@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: ISC
|
|
|
|
FROM alpine:edge
|
|
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
|
|
|
|
# hadolint ignore=DL3018
|
|
RUN apk --update upgrade \
|
|
&& apk add --no-cache \
|
|
bash bzip2 ca-certificates curl gawk git git-lfs grep jq libarchive-tools \
|
|
make npm p7zip shadow subversion unzip util-linux wget xz zip \
|
|
&& useradd -u 1337 -g users -d /home/builder -s /bin/bash builder \
|
|
&& mkdir -p /home/builder \
|
|
&& chown -R builder:users /home/builder \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
COPY override/usr/local/bin/uname /usr/local/bin/uname
|
|
# hadolint ignore=DL3018
|
|
RUN apk add --no-cache \
|
|
alpine-sdk autoconf automake bison build-base clang cmake flex libtool \
|
|
linux-headers lld nasm ninja pkgconf texinfo \
|
|
&& LLVM_MAJOR="$(clang --version | grep -Eo 'version [0-9]+' | awk '{print $2}')" \
|
|
&& export LLVM_MAJOR \
|
|
&& apk add --no-cache "clang${LLVM_MAJOR}-extra-tools" \
|
|
&& if [ ! "$(uname -m)" = "riscv64" ]; then apk add --no-cache binutils-gold; fi \
|
|
&& apk add --no-cache \
|
|
curl-dev icu-dev libxml2-dev openssl-dev zlib-dev zstd-dev \
|
|
&& addgroup builder abuild \
|
|
&& ln -s /usr/sbin/getcap /usr/bin/getcap \
|
|
&& ln -s /sbin/apk /usr/bin/apk \
|
|
&& su - builder -c "abuild-keygen -a -n" \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
|
|
ENV PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin
|
|
# hadolint ignore=DL3013,DL3018
|
|
RUN apk add --no-cache pipx reuse \
|
|
&& pipx install cmakelang \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
|
|
ENV CGO_ENABLED=1 CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOPATH=/go
|
|
# hadolint ignore=DL3018
|
|
RUN apk add --no-cache go \
|
|
&& go install github.com/mdomke/git-semver/v6@latest \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
ENV PATH ${GOPATH}/bin:$PATH
|
|
|
|
WORKDIR /etc/apk/keys
|
|
RUN DISTRO_VERSION="$(grep /main /etc/apk/repositories | tr '/' ' ' | awk '{print $(NF-1)}' | head -1)" \
|
|
&& export DISTRO_VERSION \
|
|
&& if curl --output /dev/null --silent --fail -r 0-0 "https://code.nephatrine.net/api/packages/NephNET/alpine/${DISTRO_VERSION}/main/$(cat /etc/apk/arch)/APKINDEX.tar.gz"; then echo "Installing NephNET" \
|
|
&& curl -JO https://code.nephatrine.net/api/packages/NephNET/alpine/key \
|
|
&& echo "https://code.nephatrine.net/api/packages/NephNET/alpine/${DISTRO_VERSION}/main" >>/etc/apk/repositories \
|
|
&& apk update; fi \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
|
|
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-$(uname -m)" && cd "/tmp/build-$(uname -m)" \
|
|
&& "nxbuild-linux-$(uname -m)" -GNinja "${HOME}/hello-test" \
|
|
&& ninja && ninja test \
|
|
&& cd .. && rm -rf /tmp/* /var/tmp/* "${HOME}/hello-test"
|