From ebb88b1e3a199a577400e6eadaefde42deb8e701 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 4 Jun 2023 20:35:28 +0100 Subject: [PATCH] creating image with c wrappers --- Dockerfile | 29 +++++++++++++++++++++++++++++ Jenkinsfile | 25 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c514a3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM debian AS lib_builder + +WORKDIR /foundry + +RUN apt-get update -y && apt-get install -y \ + build-essential \ + cmake \ + git + +RUN git clone https://github.com/jgarff/rpi_ws281x.git \ + && cd rpi_ws281x \ + && mkdir build \ + && cd build \ + && cmake -D BUILD_SHARED=OFF -D BUILD_TEST=OFF .. \ + && cmake --build . \ + && make install + +# Stage 1 : Build a go image with the rpi_ws281x C library and the go wrapper + +FROM golang:latest +COPY --from=lib_builder /usr/local/lib/libws2811.a /usr/local/lib/ +COPY --from=lib_builder /usr/local/include/ws2811 /usr/local/include/ws2811 + +WORKDIR /go/src/github.com/rpi-ws281x/rpi-ws281x-go +COPY . . +RUN GO111MODULE=off go get -d -v ./... +RUN GO111MODULE=off go build -v ./... + +WORKDIR /go diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..bc002c1 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,25 @@ +pipeline { +agent any +stages { + /*stage('GitCheckOut') { + steps{ + checkout([$class: 'GitSCM', branches: [[name: "${env.CHECKOUT}"]], extensions: [], userRemoteConfigs: [[credentialsId: 'gitea', url: "$GIT_URL"]]]) + } + +}*/ + stage('buildPush') { + steps{ + sh 'docker buildx rm jenkins-agent || echo "none there"' + sh '''#!/bin/bash + docker buildx create --bootstrap --name=jenkins-agent --driver=kubernetes --driver-opt=namespace=jenkinsagent --driver-opt=qemu.install=true --driver-opt=\\"nodeselector=kubernetes.io/arch=amd64\\" --driver-opt=\\"image=registry.local/buildkit-wagnerca:stable-3-rootless\\" --use + ''' + sh 'docker buildx build . -t registry.local/ws2811arm64lib:v0.0.$BUILD_NUMBER --push --platform=linux/arm64,linux/amd64' + sh 'docker buildx build . -t registry.local/ws2811arm64lib:latest --push --platform=linux/arm64,linux/amd64' + sh 'docker buildx rm jenkins-agent' + } + + +} + +} +}