Rename resoto -> fix #14
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: Build Docker Images | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
branches: | |
- main | |
pull_request: | |
paths: | |
- "Dockerfile*" | |
- "docker/**" | |
- "dockerV2/**" | |
- ".github/workflows/docker-build.yml" | |
workflow_dispatch: | |
jobs: | |
split-build: | |
name: Build Python Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Get short commit SHA | |
id: sha | |
run: echo "short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
- name: Set build platforms | |
id: platform | |
run: | | |
GITHUB_REF="${{ github.ref }}" | |
GITHUB_TAG=${GITHUB_REF##*/} | |
if [ "${{ github.ref_type }}" = tag ]; then | |
echo "targets=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT | |
echo "latest=true" >> $GITHUB_OUTPUT | |
else | |
echo "targets=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT | |
echo "latest=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Check short commit SHA and build targets | |
run: | | |
echo ${{ steps.sha.outputs.short }} | |
echo ${{ steps.platform.outputs.targets }} | |
echo ${{ steps.platform.outputs.latest }} | |
- name: Docker fixpython meta | |
id: pythonmeta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
someengineering/fixpython | |
ghcr.io/someengineering/fixpython | |
flavor: | | |
latest=${{ steps.platform.outputs.latest }} | |
tags: | | |
type=pep440,pattern={{version}} | |
type=pep440,pattern={{major}}.{{minor}} | |
type=pep440,pattern={{major}} | |
type=sha,prefix= | |
type=edge | |
labels: | | |
org.opencontainers.image.title=fixpython | |
org.opencontainers.image.description=Fix Inventory Python base image | |
org.opencontainers.image.vendor=Some Engineering Inc. | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64,amd64 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push fixpython Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ steps.platform.outputs.targets }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.pythonmeta.outputs.tags }} | |
labels: ${{ steps.pythonmeta.outputs.labels }} |