From 47662e978635fbd5f67c0ac1b4fec75d288bcc3e Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Sat, 18 Feb 2023 11:34:27 +0100 Subject: [PATCH] feat(ci): add Drone config --- .drone.yml | 51 ++++++++++++++++++++++++++++ common/hetzner-bullseye-sources.list | 4 +++ ko/Dockerfile | 7 ++-- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 .drone.yml create mode 100644 common/hetzner-bullseye-sources.list diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..1ce39d0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,51 @@ +--- +kind: pipeline +type: docker +name: default + +steps: + +- name: ko + image: gcr.io/kaniko-project/executor:debug + network_mode: host + commands: + - > + echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $$GITEA_USER $$GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json + - /kaniko/executor --destination "$${IMAGE_REPO}:$${IMAGE_TAG}" --context "$${BUILD_CONTEXT}" + environment: + GITEA_USER: prskr + GITEA_TOKEN: + from_secret: gitea_token + IMAGE_REPO: code.icb4dc0.de/prskr/ci-images/ko + IMAGE_TAG: latest + BUILD_CONTEXT: ko/ + +- name: dind-go + image: gcr.io/kaniko-project/executor:debug + network_mode: host + commands: + - > + echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $$GITEA_USER $$GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json + - /kaniko/executor --destination "$${IMAGE_REPO}:$${IMAGE_TAG}" --context "$${BUILD_CONTEXT}" + environment: + GITEA_USER: prskr + GITEA_TOKEN: + from_secret: gitea_token + IMAGE_REPO: code.icb4dc0.de/prskr/ci-images/dind-go + IMAGE_TAG: latest + BUILD_CONTEXT: dind-go/ + +- name: caddy + image: gcr.io/kaniko-project/executor:debug + network_mode: host + commands: + - > + echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $$GITEA_USER $$GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json + - /kaniko/executor --destination "$${IMAGE_REPO}:$${IMAGE_TAG}" --context "$${BUILD_CONTEXT}" + environment: + GITEA_USER: prskr + GITEA_TOKEN: + from_secret: gitea_token + IMAGE_REPO: code.icb4dc0.de/prskr/ci-images/caddy + IMAGE_TAG: latest + BUILD_CONTEXT: caddy/ \ No newline at end of file diff --git a/common/hetzner-bullseye-sources.list b/common/hetzner-bullseye-sources.list new file mode 100644 index 0000000..c47bafa --- /dev/null +++ b/common/hetzner-bullseye-sources.list @@ -0,0 +1,4 @@ +deb https://mirror.hetzner.com/debian/packages bullseye main contrib non-free +deb https://mirror.hetzner.com/debian/packages bullseye-updates main contrib non-free +deb https://mirror.hetzner.com/debian/security bullseye-security main contrib non-free +deb https://mirror.hetzner.com/debian/packages bullseye-backports main contrib non-free \ No newline at end of file diff --git a/ko/Dockerfile b/ko/Dockerfile index 200045a..7c8184c 100644 --- a/ko/Dockerfile +++ b/ko/Dockerfile @@ -1,9 +1,6 @@ -FROM docker.io/golang:1.20-bullseye as downloader +FROM docker.io/alpine:latest as downloader -RUN apt-get update && \ - apt-get install -y \ - curl \ - jq && \ +RUN apk add -U --no-cache curl jq && \ export KO_VERSION=$(curl https://api.github.com/repos/ko-build/ko/releases | jq -r '. | first |.tag_name | capture("(?[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+)") | .version') && \ curl -L "https://github.com/ko-build/ko/releases/download/v${KO_VERSION}/ko_${KO_VERSION}_Linux_x86_64.tar.gz" | tar xvz -C /tmp