build: Fix Docker workflow (#80)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
Alexandre Teles (afterSt0rm) 2024-06-09 08:34:42 -03:00 committed by GitHub
parent 3769122858
commit 2cb04fdd63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View File

@ -10,14 +10,6 @@ env:
jobs:
docker:
strategy:
fail-fast: false
matrix:
arch: [
# [use-cross, target, platform, tag]
[false, x86_64-unknown-linux-gnu, linux/amd64, latest],
[true, aarch64-unknown-linux-gnu, linux/arm64/v8, latest-arm64],
]
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -29,7 +21,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.arch[1] }}
target: aarch64-unknown-linux-gnu
override: true
- name: Setup Rust Cache
@ -40,13 +32,13 @@ jobs:
id: rust_build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.arch[0] }}
use-cross: true
command: build
args: --release --target ${{ matrix.arch[1] }}
args: --release --target aarch64-unknown-linux-gnu
- name: Setup QEMU
id: qemu
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
id: buildx
@ -54,7 +46,7 @@ jobs:
- name: Login to DockerHub
id: login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -65,8 +57,8 @@ jobs:
with:
context: .
file: ./Dockerfile
platforms: ${{ matrix.arch[2] }}
platforms: linux/arm64/v8
cache-to: type=gha,mode=max,ignore-error=true
cache-from: type=gha
push: true
tags: 'revanced/revanced-discord-bot:${{ matrix.arch[3] }}'
tags: 'revanced/revanced-discord-bot:latest-arm64'

View File

@ -1,4 +1,4 @@
FROM ubuntu:latest
COPY ./target/**/release/revanced-discord-bot /
COPY ./target/aarch64-unknown-linux-gnu/release/revanced-discord-bot /
CMD ["/revanced-discord-bot"]