rosenvold-core/.forgejo/workflows/build.yml

57 lines
1.9 KiB
YAML
Raw Normal View History

name: Build and push image
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: docker
# actions/checkout & co. are JS actions and need Node, so the job
# container has to be a Node image (not a bare docker CLI image). We
# install the Docker CLI into it and talk to a sidecar dind daemon over
# the network instead of relying on the runner exposing a host socket.
container: node:20-bookworm
services:
docker:
image: docker:27-dind
options: --privileged
env:
DOCKER_HOST: tcp://docker:2375
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" \
> /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y --no-install-recommends docker-ce-cli docker-buildx-plugin
- name: Log in to Forgejo registry
uses: docker/login-action@v3
with:
registry: git.rosenvold.tech
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
push: true
tags: |
git.rosenvold.tech/lucas/rosenvold-core:latest
git.rosenvold.tech/lucas/rosenvold-core:${{ github.sha }}