Add build and deploy workflows
Some checks failed
Build and push container image / build (push) Has been cancelled
Some checks failed
Build and push container image / build (push) Has been cancelled
This commit is contained in:
parent
f0db44f672
commit
67116539ab
37
.gitea/workflows/build.yml
Normal file
37
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: Build and push container image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-22.04-node
|
||||||
|
steps:
|
||||||
|
- name: Install and setup Docker
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
echo \
|
||||||
|
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
|
||||||
|
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
apt update
|
||||||
|
apt install -y docker-ce docker-ce-cli containerd.io
|
||||||
|
- name: Checkout branch
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.toast-server.net
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v5.1.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: git.toast-server.net/toast/kon:main
|
||||||
|
cache-from: type=registry,ref=git.toast-server.net/toast/kon:main
|
||||||
|
cache-to: type=inline
|
19
.gitea/workflows/deploy.yml
Normal file
19
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
name: Deploy to host
|
||||||
|
on:
|
||||||
|
registry_package:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-22.04-node
|
||||||
|
steps:
|
||||||
|
- name: SSH into Docker Host
|
||||||
|
uses: appleboy/ssh-action@55dabf81b49d4120609345970c91507e2d734799
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SSH_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
port: ${{ secrets.SSH_PORT }}
|
||||||
|
script: |
|
||||||
|
cd kon && docker compose pull && \
|
||||||
|
docker compose up -d --remove-orphans && docker image prune -f
|
Loading…
Reference in New Issue
Block a user