jenkins-agent-with-docker/.github/workflows/build-image.yml

37 lines
1.1 KiB
YAML

name: Build container image
on:
push:
branches:
- "main"
paths:
- "LATEST_VERSION"
workflow_dispatch:
jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get version
id: get-version
run: echo "::set-output name=version::$(cat LATEST_VERSION)"
- name: Build and push container image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: lamgc/jenkins-agent-docker:latest, lamgc/jenkins-agent-docker:${{ steps.get-version.outputs.version }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max