Update drone

This commit is contained in:
Aode (lion) 2021-12-04 17:27:23 -06:00
parent 49bc787bca
commit be909210eb
3 changed files with 162 additions and 9 deletions

View file

@ -82,11 +82,11 @@ steps:
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
- chown -R 991:991 . - chown -R 991:991 .
- name: build - name: check
image: asonix/rust-builder:amd64-latest image: asonix/rust-builder:amd64-latest
pull: always pull: always
commands: commands:
- cargo check --target=x86_64-unknown-linux-musl - cargo check --target=$TARGET
trigger: trigger:
event: event:
@ -118,7 +118,32 @@ steps:
image: asonix/rust-builder:amd64-latest image: asonix/rust-builder:amd64-latest
pull: always pull: always
commands: commands:
- cargo build --target=x86_64-unknown-linux-musl --release - cargo build --target=$TARGET --release
- $TOOL-strip target/$TARGET/release/relay
- cp target/$TARGET/release/relay .
- cp relay relay-linux-amd64
- name: push
image: plugins/docker:20
settings:
username: asonix
password:
from_secret: dockerhub_token
repo: asonix/relay
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:
- relay-linux-amd64
trigger: trigger:
event: event:
@ -145,11 +170,11 @@ steps:
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
- chown -R 991:991 . - chown -R 991:991 .
- name: build - name: check
image: asonix/rust-builder:arm64v8-latest image: asonix/rust-builder:arm64v8-latest
pull: always pull: always
commands: commands:
- cargo check --target=aarch64-unknown-linux-musl - cargo check --target=$TARGET
trigger: trigger:
event: event:
@ -181,7 +206,32 @@ steps:
image: asonix/rust-builder:arm64v8-latest image: asonix/rust-builder:arm64v8-latest
pull: always pull: always
commands: commands:
- cargo build --target=aarch64-unknown-linux-musl --release - cargo build --target=$TARGET --release
- $TOOL-strip target/$TARGET/release/relay
- cp target/$TARGET/release/relay .
- cp relay relay-linux-arm64v8
- name: push
image: plugins/docker:20
settings:
username: asonix
password:
from_secret: dockerhub_token
repo: asonix/relay
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:
- relay-linux-arm64v8
trigger: trigger:
event: event:
@ -208,11 +258,11 @@ steps:
- git checkout $DRONE_COMMIT - git checkout $DRONE_COMMIT
- chown -R 991:991 . - chown -R 991:991 .
- name: build - name: check
image: asonix/rust-builder:arm32v7-latest image: asonix/rust-builder:arm32v7-latest
pull: always pull: always
commands: commands:
- cargo check --target=armv7-unknown-linux-musleabihf - cargo check --target=$TARGET
trigger: trigger:
event: event:
@ -244,7 +294,74 @@ steps:
image: asonix/rust-builder:arm32v7-latest image: asonix/rust-builder:arm32v7-latest
pull: always pull: always
commands: commands:
- cargo build --target=armv7-unknown-linux-musleabihf --release - cargo build --target=$TARGET --release
- $TOOL-strip target/$TARGET/release/relay
- cp target/$TARGET/release/relay .
- cp relay relay-linux-arm32v7
- name: push
image: plugins/docker:20
settings:
username: asonix
password:
from_secret: dockerhub_token
repo: asonix/relay
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:
- relay-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: trigger:
event: event:

11
docker/drone/Dockerfile Normal file
View file

@ -0,0 +1,11 @@
ARG REPO_ARCH
FROM asonix/rust-runner:$REPO_ARCH-latest
COPY relay /usr/local/bin/relay
USER app
EXPOSE 8080
VOLUME /mnt
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/relay"]

View file

@ -0,0 +1,25 @@
image: asonix/relay:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
-
image: asonix/relay:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: asonix/relay:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64v8
platform:
architecture: arm64
os: linux
variant: v8
-
image: asonix/relay:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm32v7
platform:
architecture: arm
os: linux
variant: v7