maddy-admin/.forgejo/workflows/docker-build.yml

59 lines
1.9 KiB
YAML
Raw Normal View History

2024-01-24 09:11:57 +00:00
name: Docker Build
on:
push:
branches:
2024-01-24 09:12:25 +00:00
- "main"
2024-01-24 09:11:57 +00:00
tags:
- "*"
workflow_dispatch:
jobs:
publish_api:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2024-01-24 09:44:47 +00:00
- name: Install Docker
run: |-
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" > /etc/apt/sources.list.d/docker.list
apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq -y docker-ce-cli docker-buildx-plugin docker-compose-plugin
- name: Docker meta
2024-01-24 09:11:57 +00:00
id: meta
uses: actions/docker-metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: git.amogus.cloud/lea/maddy-admin
# generate Docker tags based on branch and short commit SHA
tags: |
type=ref,event=branch
type=sha
2024-01-24 09:44:47 +00:00
- name: Set up QEMU
2024-01-24 09:11:57 +00:00
uses: actions/docker-setup-qemu-action@v2
2024-01-24 09:44:47 +00:00
- name: Set up Docker Buildx
2024-01-24 09:11:57 +00:00
uses: actions/docker-setup-buildx-action@v2
2024-01-24 09:44:47 +00:00
- name: Login to registry
2024-01-24 09:11:57 +00:00
uses: actions/docker-login-action@v2
with:
registry: git.amogus.cloud
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
2024-01-24 09:44:47 +00:00
- name: Build and push
2024-01-24 09:11:57 +00:00
uses: actions/docker-build-push-action@v3
with:
2024-01-24 11:06:57 +00:00
context: .
2024-01-24 09:11:57 +00:00
platforms: linux/amd64,linux/arm64
2024-01-24 11:06:57 +00:00
push: true
tags: ${{ steps.meta.outputs.tags }}