contrib/jenkins: add script to build in docker

Related: SYS#6356
This commit is contained in:
Oliver Smith 2023-05-15 12:37:30 +02:00
parent df979a37b5
commit 861db3cfa8
2 changed files with 76 additions and 0 deletions

38
contrib/Dockerfile Normal file
View File

@ -0,0 +1,38 @@
ARG REGISTRY=docker.io
FROM ${REGISTRY}/debian/eol:jessie-slim
# Arguments used after FROM must be specified again
ARG UID
RUN ( echo "deb http://archive.debian.org/debian jessie main"; \
echo "deb http://archive.debian.org/debian-security jessie/updates main" ) \
> /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
chrpath \
cpio \
diffstat \
file \
gawk \
git \
locales \
make \
python \
python3 \
texinfo \
wget \
&& \
apt-get clean
# Disable DST Root CA X3
# https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/
RUN sed -i '/^mozilla\/DST_Root_CA_X3.crt$/ s/^/!/' /etc/ca-certificates.conf && \
update-ca-certificates
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen
RUN useradd --uid=${UID} -m user
USER user

38
contrib/jenkins.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh -e
DOCKER_IMG="sysmocom-system-images-oe"
if [ -z "$SSH_AUTH_SOCK" ]; then
echo "ERROR: SSH_AUTH_SOCK is empty!"
exit 1
fi
set -x
cd "$(dirname "$(realpath "$0")")/.."
docker build \
--build-arg UID=$(id -u) \
-t "$DOCKER_IMG":latest \
contrib
docker run \
-it \
--rm \
-e SSH_AUTH_SOCK=/ssh-agent \
-v "$(readlink -f "$SSH_AUTH_SOCK")":/ssh-agent \
-v "$PWD:/system-images" \
"$DOCKER_IMG" \
sh -e -x -c "
export LC_ALL=en_US.UTF-8
cd /system-images
make clean-all || true
make build-all
make sysmobts-upload FEED_NAME=\"201705-nightly\"
make sysmobts2100-upload FEED_NAME=\"201705-nightly\"
make oc2g-upload FEED_NAME=\"201705-nightly\"
make sysmocom-alix-upload FEED_NAME=\"201705-nightly\"
make sysmocom-apu2-upload FEED_NAME=\"201705-nightly\"
make clean-all
"