From 78285c2a6d0c7566e80b0355490606babc21f3fa Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Sat, 4 Dec 2021 16:48:37 -0600 Subject: [PATCH] Add drone publishing --- .drone.yml | 135 ++++++++++++++++++++++++++++++++++--- docker/drone/Dockerfile | 16 +++++ docker/drone/manifest.tmpl | 25 +++++++ 3 files changed, 167 insertions(+), 9 deletions(-) create mode 100644 docker/drone/Dockerfile create mode 100644 docker/drone/manifest.tmpl diff --git a/.drone.yml b/.drone.yml index 3cebc6b..20056ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -82,11 +82,11 @@ steps: - git checkout $DRONE_COMMIT - chown -R 991:991 . -- name: build +- name: check image: asonix/rust-builder:amd64-latest pull: always commands: - - cargo check --target=x86_64-unknown-linux-musl + - cargo check --target=$TARGET trigger: event: @@ -118,7 +118,32 @@ steps: image: asonix/rust-builder:amd64-latest pull: always commands: - - cargo build --target=x86_64-unknown-linux-musl --release + - cargo build --target=$TARGET --release + - $TOOL-strip target/$TARGET/release/pict-rs-aggregator + - cp target/$TARGET/release/pict-rs-aggregator . + - cp pict-rs-aggregator pict-rs-aggregator-linux-amd64 + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pictrs-aggregator + dockerfile: docker/drone/Dockerfile + auto_tag: true + auto_tag_suffix: linux-amd64 + build_args: + - REPO_ARCH=amd64 + +- name: publish + image: plugins/gitea-release:1 + settings: + api_key: + from_secret: gitea_token + base_url: https://git.asonix.dog + files: + - pict-rs-aggregator-linux-amd64 trigger: event: @@ -145,11 +170,11 @@ steps: - git checkout $DRONE_COMMIT - chown -R 991:991 . -- name: build +- name: check image: asonix/rust-builder:arm64v8-latest pull: always commands: - - cargo check --target=aarch64-unknown-linux-musl + - cargo check --target=$TARGET trigger: event: @@ -181,7 +206,32 @@ steps: image: asonix/rust-builder:arm64v8-latest pull: always commands: - - cargo build --target=aarch64-unknown-linux-musl --release + - cargo build --target=$TARGET --release + - $TOOL-strip target/$TARGET/release/pict-rs-aggregator + - cp target/$TARGET/release/pict-rs-aggregator . + - cp pict-rs-aggregator pict-rs-aggregator-linux-arm64v8 + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pictrs-aggregator + dockerfile: docker/drone/Dockerfile + auto_tag: true + auto_tag_suffix: linux-arm64v8 + build_args: + - REPO_ARCH=arm64v8 + +- name: publish + image: plugins/gitea-release:1 + settings: + api_key: + from_secret: gitea_token + base_url: https://git.asonix.dog + files: + - pict-rs-aggregator-linux-arm64v8 trigger: event: @@ -208,11 +258,11 @@ steps: - git checkout $DRONE_COMMIT - chown -R 991:991 . -- name: build +- name: check image: asonix/rust-builder:arm32v7-latest pull: always commands: - - cargo check --target=armv7-unknown-linux-musleabihf + - cargo check --target=$TARGET trigger: event: @@ -244,7 +294,74 @@ steps: image: asonix/rust-builder:arm32v7-latest pull: always commands: - - cargo build --target=armv7-unknown-linux-musleabihf --release + - cargo build --target=$TARGET --release + - $TOOL-strip target/$TARGET/release/pict-rs-aggregator + - cp target/$TARGET/release/pict-rs-aggregator . + - cp pict-rs-aggregator pict-rs-aggregator-linux-arm32v7 + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pictrs-aggregator + dockerfile: docker/drone/Dockerfile + auto_tag: true + auto_tag_suffix: linux-arm32v7 + build_args: + - REPO_ARCH=arm32v7 + +- name: publish + image: plugins/gitea-release:1 + settings: + api_key: + from_secret: gitea_token + base_url: https://git.asonix.dog + files: + - pict-rs-aggregator-linux-arm32v7 + +trigger: + event: + - tag + +--- + +kind: pipeline +type: docker +name: manifest + +platform: + arch: amd64 + +clone: + disable: true + +steps: +- name: clone + image: alpine/git:latest + user: root + commands: + - git clone $DRONE_GIT_HTTP_URL . + - git checkout $DRONE_COMMIT + - chown -R 991:991 . + +- name: manifest + image: plugins/manifest:1 + settings: + username: asonix + password: + from_secret: dockerhub_token + dump: true + auto_tag: true + ignore_missing: true + spec: docker/drone/manifest.tmpl + + +depends_on: +- build-amd64 +- build-arm64v8 +- build-arm32v7 trigger: event: diff --git a/docker/drone/Dockerfile b/docker/drone/Dockerfile new file mode 100644 index 0000000..536e949 --- /dev/null +++ b/docker/drone/Dockerfile @@ -0,0 +1,16 @@ +ARG REPO_ARCH + +FROM asonix/rust-runner:$REPO_ARCH-latest + +USER root +RUN \ + apk add exiftool imagemagick ffmpeg && \ + chown -R app:app /mnt + +COPY pict-rs-aggregator /usr/local/bin/pict-rs-aggregator + +USER app +EXPOSE 8080 +VOLUME /mnt +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["/usr/local/bin/pict-rs-aggregator", "-p", "/mnt"] diff --git a/docker/drone/manifest.tmpl b/docker/drone/manifest.tmpl new file mode 100644 index 0000000..db6fae2 --- /dev/null +++ b/docker/drone/manifest.tmpl @@ -0,0 +1,25 @@ +image: asonix/pictrs-aggregator:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - + image: asonix/pictrs-aggregator:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: asonix/pictrs-aggregator:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64v8 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: asonix/pictrs-aggregator:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm32v7 + platform: + architecture: arm + os: linux + variant: v7