Docker build samba image #21214
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build samba image | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
paths: | |
- '.github/workflows/docker-build-samba.yml' | |
- 'samba/**' | |
jobs: | |
build: | |
runs-on: ${{ (github.event_name == 'push') && fromJSON('[ "buildjet-4vcpu-ubuntu-2204-arm" ]') || 'ubuntu-latest' }} | |
steps: | |
- name: Get latest commit hash | |
id: get-latest-commit | |
run: | | |
echo "commit=$(git ls-remote --tags --sort="v:refname" https://github.com/samba-team/samba.git | grep samba-4 | tail -n1 | awk '{print $1;}')" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: samba | |
key: ${{ runner.os }}-v1-${{ env.commit }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
platforms: all | |
- name: Check Out Repo | |
uses: actions/checkout@v3 | |
- name: Check Out Repo dperson/samba | |
uses: actions/checkout@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: "dperson/samba" | |
ref: 'master' | |
path: 'samba-git' | |
- name: Login to Quay.io | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Set up Docker Buildx | |
if: steps.cache.outputs.cache-hit != 'true' | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Override samba file | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: cp samba/samba.sh samba-git/ | |
- name: Set up build timestamp | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: echo "timestamp=$(date +%Y%m%d)" >> $GITHUB_ENV | |
- name: Build and push docker image | |
if: steps.cache.outputs.cache-hit != 'true' | |
id: docker_build_new | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./samba-git | |
file: ./samba-git/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: quay.io/unixfox/samba:latest, quay.io/unixfox/samba:build-${{ env.timestamp }} |