Skip to content

Build and push OCI image #736

Build and push OCI image

Build and push OCI image #736

Workflow file for this run

name: Build and push OCI image
on:
schedule:
- cron: '7 7 * * *' # UTC
push:
branches:
- main
workflow_dispatch:
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC3037 -e SC3057 -e SC3060
- name: Max. 79 characters per line
run: |
wc -L *.sh | sort -nr
MLL=$(gawk '{ if(length > L) { L=length } } END { print L }' *.sh)
(( ${MLL:-80} <= 79 )) || exit 1
build:
needs: shellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create image metadata
id: meta
run: echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Quay Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
tags: |
smblds/smblds:latest
quay.io/smblds/smblds:latest
labels: |
org.opencontainers.image.created=${{ steps.meta.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.label-schema.build-date=${{ steps.meta.outputs.created }}
org.label-schema.vcs-ref=${{ github.sha }}
provenance: false
check:
needs: build
runs-on: ubuntu-latest
container: smblds/smblds:latest
steps:
- name: Run ENTRYPOINT explicitly
run: /entrypoint.sh /bin/sh
- name: Run ldbsearch against Samba
run: ldbsearch -H /var/lib/samba/private/sam.ldb > /dev/null
- name: Wait for started Samba services
run: for cnt in $(seq 1 9); do netstat -lnpt | grep :389 && netstat -lnpt | grep :636 && break || sleep 1; done
- name: Run ldapsearch against Samba
run: ldapsearch -v > /dev/null