Add drone publishing

This commit is contained in:
Aode (lion) 2021-12-04 16:48:37 -06:00
parent 3f7a342f19
commit 78285c2a6d
3 changed files with 167 additions and 9 deletions

View file

@ -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:

16
docker/drone/Dockerfile Normal file
View file

@ -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"]

View file

@ -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