2023-12-08 06:25:57 -05:00
|
|
|
name: Build and push container image
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-22.04-node
|
|
|
|
steps:
|
2024-01-07 07:24:36 -05:00
|
|
|
- name: Set up Docker environment
|
|
|
|
run: |
|
2024-01-07 07:57:46 -05:00
|
|
|
apt update && apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
|
2024-01-07 07:24:36 -05:00
|
|
|
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
|
2024-01-07 07:57:46 -05:00
|
|
|
apt update && apt upgrade -y && \
|
2024-01-07 07:24:36 -05:00
|
|
|
apt install -y docker-ce docker-ce-cli containerd.io
|
2024-01-07 07:02:43 -05:00
|
|
|
|
2023-12-08 06:25:57 -05:00
|
|
|
- name: Checkout branch
|
2023-12-08 06:26:18 -05:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2024-01-07 07:02:43 -05:00
|
|
|
|
2023-12-08 06:25:57 -05:00
|
|
|
- name: Login to Gitea
|
2023-12-08 06:26:18 -05:00
|
|
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
|
2023-12-08 06:25:57 -05:00
|
|
|
with:
|
|
|
|
registry: git.toast-server.net
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
2024-01-07 07:02:43 -05:00
|
|
|
|
2024-01-07 08:44:11 -05:00
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v3 # v3
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
2024-01-07 08:28:30 -05:00
|
|
|
- name: Set up Docker Buildx
|
2024-01-07 08:28:58 -05:00
|
|
|
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3
|
2024-01-07 08:28:30 -05:00
|
|
|
|
2023-12-08 06:25:57 -05:00
|
|
|
- name: Build and push image
|
2023-12-08 06:26:18 -05:00
|
|
|
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
|
2023-12-08 06:25:57 -05:00
|
|
|
with:
|
|
|
|
platforms: linux/amd64
|
|
|
|
push: true
|
|
|
|
tags: git.toast-server.net/toast/kon:main
|
2024-01-07 08:44:11 -05:00
|
|
|
cache-from: type=registry,ref=git.toast-server.net/toast/kon:main
|
|
|
|
cache-to: type=inline
|