This repository has been archived on 2025-07-06. You can view files and clone it, but cannot push or open issues or pull requests.
docker-almalinux-buildrunner/.gitea/workflows/build.yaml
Ben Vincent c920d9ed8f
Some checks failed
Build / Build Docker Image (pull_request) Failing after 0s
Build / Deploy Docker Image (pull_request) Has been skipped
feat: initial commit
- add Makefile
- add gitea workflows
- add Dockerfile
2024-09-08 00:15:21 +10:00

83 lines
2.0 KiB
YAML

name: Build
on:
pull_request:
branches:
- '**'
push:
branches:
- master
jobs:
build:
name: Build Docker Image
runs-on: almalinux-8
services:
docker:
image: docker:dind
options: --privileged
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
apk add --no-cache make bash git
- name: Build Docker image
if: github.event_name == 'pull_request'
run: |
make build
- name: Save Docker context
if: github.event_name == 'pull_request'
run: tar -czf build-context.tar.gz .
- name: Upload build artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: build-context
path: build-context.tar.gz
deploy:
name: Deploy Docker Image
runs-on: almalinux-8
needs: build
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
services:
docker:
image: docker:dind
options: --privileged
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout code
uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-context
- name: Extract build artifacts
run: tar -xzf build-context.tar.gz
- name: Install dependencies
run: |
apk add --no-cache make bash git
- name: Log in to Docker
env:
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }}
run: echo "${{ secrets.UPLOAD_PASS }}" | docker login --username "${{ secrets.UPLOAD_USER }}" --password-stdin git.query.consul
- name: Push Docker image
run: |
make push