From 4318121e05fcfba4cc1e47c27eeeec6e64afaba9 Mon Sep 17 00:00:00 2001 From: Udo Waechter Date: Mon, 12 Apr 2021 09:42:19 +0200 Subject: [PATCH] our own build-env image --- Dockerfile | 19 ++++++++++ build-oxnas820.yaml | 32 ++++------------- openwrt-build-image.yaml | 75 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 26 deletions(-) create mode 100644 Dockerfile create mode 100644 openwrt-build-image.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..56ca26e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM docker.io/openjdk:jdk-buster + +RUN sed -i 's@deb.debian.org@apt-cache.lan/deb.debian.org@g' /etc/apt/sources.list; \ + sed -i 's@security.debian.org@apt-cache.lan/security.debian.org@g' /etc/apt/sources.list; \ + apt update -y; \ + apt install -y build-essential ccache ecj fastjar file g++ gawk \ + gettext git java-propose-classpath libelf-dev libncurses5-dev \ + libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ + python3-distutils python3-setuptools rsync subversion swig time \ + xsltproc zlib1g-dev make distcc distcc-pump; \ + apt-get remove --purge -y exim* && \ + apt-get autoremove --purge -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/cache/apt/* && \ + ln -sv /usr/lib/distcc-pump/lib/python3.7/site-packages/include_server /usr/lib/distcc-pump/include_server && \ + rm -v /etc/distcc/hosts + + \ No newline at end of file diff --git a/build-oxnas820.yaml b/build-oxnas820.yaml index a460729..77c8b63 100644 --- a/build-oxnas820.yaml +++ b/build-oxnas820.yaml @@ -29,31 +29,9 @@ spec: - name: openwrt-configs type: git steps: - - name: setup - #image: cr.lan/debian-stable-build-essential - image: docker.io/openjdk/jdk-buster - script: | - #!/usr/bin/env bash - #echo 'deb-src http://apt-cache.lan/deb.debian.org/debian testing main' > /etc/apt/sources.list.d/src-testing.list - #echo 'deb http://apt-cache.lan/deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing.list - apt update -y - export DEBIAN_FRONTEND=noninteractive - echo "HACK openjdk bug" - mkdir -p /etc/ssl/certs/java - touch /etc/ssl/certs/java/cacerts - mkdir -p /usr/share/man/man1 - touch /usr/share/man/man1/rmid.1.gz.dpkg-tmp - echo "////////// HACK openjdk bug" - apt install -y ca-certificates-java - dpkg --configure -a - apt install -y build-essential ccache ecj fastjar file g++ gawk \ - gettext git java-propose-classpath libelf-dev libncurses5-dev \ - libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ - python3-distutils python3-setuptools rsync subversion swig time \ - xsltproc zlib1g-dev - name: openwrt-get #image: cr.lan/debian-stable-build-essential - image: docker.io/openjdk/jdk-buster + image: cr.lan/debian-stable-openwrt-build script: | #!/usr/bin/env bash if [ ! -d /usr/src/openwrt ]; then @@ -66,7 +44,7 @@ spec: git pull - name: build-openwrt #image: cr.lan/debian-stable-build-essential - image: docker.io/openjdk/jdk-buster + image: cr.lan/debian-stable-openwrt-build script: | #!/usr/bin/env bash @@ -83,8 +61,10 @@ spec: cp -v $(resources.inputs.openwrt-configs.path)/$(params.config) \ /usr/src/openwrt/.config || exit 1 cd /usr/src/openwrt - ./scripts/feeds update -a - ./scripts/feeds install -a + + ls -la . + #./scripts/feeds update -a + #./scripts/feeds install -a #distcc-pump make -j20 download world CC=distcc $(params.make_flags) make -j2 download world $(params.make_flags) workspaces: diff --git a/openwrt-build-image.yaml b/openwrt-build-image.yaml new file mode 100644 index 0000000..3c20a30 --- /dev/null +++ b/openwrt-build-image.yaml @@ -0,0 +1,75 @@ +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: openwrt-configs-git +spec: + type: git + params: + - name: revision + value: master + - name: url + value: http://git-ui.lan/chaos/openwrt-configs.git +--- +apiVersion: tekton.dev/v1alpha1 +kind: PipelineResource +metadata: + name: img-debian-stable-openwrt-build +spec: + type: image + params: + - name: url + value: cr.lan/debian-stable-openwrt-build +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: build-debian-stable-openwrt-build +spec: + params: + - name: pathToContainerFile + type: string + default: $(resources.inputs.source.path)/Dockerfile + - name: pathToContext + type: string + default: $(resources.inputs.source.path) + resources: + inputs: + - name: source + type: git + outputs: + - name: builtImage + type: image + steps: + - name: build-and-push + image: gcr.io/kaniko-project/executor:arm64 + command: + - /kaniko/executor + args: + - --dockerfile=$(params.pathToContainerFile) + - --destination=$(resources.outputs.builtImage.url) + - --context=$(params.pathToContext) + - --snapshotMode=redo + - --skip-tls-verify +--- +apiVersion: tekton.dev/v1beta1 +kind: TaskRun +metadata: + name: img-debian-stable-openwrt-build +spec: + taskRef: + name: build-debian-stable-openwrt-build + params: + - name: pathToContainerFile + value: Dockerfile + resources: + inputs: + - name: source + resourceRef: + name: openwrt-configs-git + outputs: + - name: builtImage + resourceRef: + name: img-debian-stable-openwrt-build + + + \ No newline at end of file