mirror of
https://github.com/revanced/revanced-discord-bot.git
synced 2025-04-30 06:24:27 +02:00
ci: release Docker image (#54)
This commit is contained in:
parent
dd083ac77c
commit
00a7de6a93
72
.github/workflows/docker.yml
vendored
Normal file
72
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: Release Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, dev]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [
|
||||||
|
# [use-cross, target, platform]
|
||||||
|
[false, x86_64-unknown-linux-gnu, linux/amd64],
|
||||||
|
[true, aarch64-unknown-linux-gnu, linux/arm64/v8],
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Rust toolchain
|
||||||
|
id: rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
target: ${{ matrix.arch[1] }}
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Setup Rust Cache
|
||||||
|
id: rust-cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
id: rust_build
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.arch[0] }}
|
||||||
|
command: build
|
||||||
|
args: --release --target ${{ matrix.arch[1] }}
|
||||||
|
|
||||||
|
- name: Setup QEMU
|
||||||
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
id: login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build Image and Push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: ${{ matrix.arch[2] }}
|
||||||
|
cache-to: type=gha,mode=max,ignore-error=true
|
||||||
|
cache-from: type=gha
|
||||||
|
push: true
|
||||||
|
tags: revanced/revanced-discord-bot:latest
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM gcr.io/distroless/cc
|
||||||
|
# Discord info
|
||||||
|
ARG DISCORD_AUTHORIZATION_TOKEN
|
||||||
|
ENV DISCORD_AUTHORIZATION_TOKEN $DISCORD_AUTHORIZATION_TOKEN
|
||||||
|
# MongoDB info
|
||||||
|
ARG MONGODB_URI
|
||||||
|
ENV MONGODB_URI $MONGODB_URI
|
||||||
|
COPY ./target/**/release/revanced-discord-bot /
|
||||||
|
CMD ["/revanced-discord-bot"]
|
Loading…
x
Reference in New Issue
Block a user