kasbot/.gitea/workflows/master.yml
Jose Henrique 1b283a4947
Some checks failed
Master Build / Build and Push Docker Image (amd64) (push) Failing after 6s
Master Build / Build and Push Docker Image (arm64) (push) Failing after 9s
Master Build / Update running container (push) Has been skipped
attempt
2025-01-19 11:24:07 -03:00

104 lines
2.8 KiB
YAML

name: Master Build
on:
push:
branches: [ "master" ]
jobs:
build_amd64:
name: Build and Push Docker Image (amd64)
runs-on: self-hosted-ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install docker and docker compose
run: |
sudo apt-get update
sudo apt-get install -y docker docker-compose
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: https://github.com/docker/setup-buildx-action@v3.8.0
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build Docker image and push
id: docker_build
uses: https://github.com/docker/build-push-action@v6.12.0
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/kasbot:latest
platforms: linux/amd64
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
build_arm64:
name: Build and Push Docker Image (arm64)
runs-on: self-hosted-ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Set up QEMU
uses: https://github.com/docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: https://github.com/docker/setup-buildx-action@v3.8.0
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build Docker image and push
id: docker_build
uses: https://github.com/docker/build-push-action@v6.12.0
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/kasbot:latest
platforms: linux/arm64
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy:
name: Update running container
runs-on: self-hosted-ubuntu-latest
needs: build_arm64
steps:
- name: Recreate container
uses: https://github.com/appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd docker/kasbot
docker compose down
docker compose rm
docker compose pull
docker compose up -d