Skip to content

Commit

Permalink
adding docker image build.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Jan 20, 2025
1 parent 1eb303e commit 0e72ad3
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Docker
on:
push:
branches: [ main, docker_image ]
# Publish semver tags as releases.
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true


jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=true
tags: |
# if this is a tag'd build, prefix it with the flavor (eg. main-v1.2.3 and sandbox-v1.2.3)
type=ref,event=tag
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# sbom: true
# sbom-dir: ./sbom-output
# - name: upload SBOM directory as a build artifact
# uses: actions/[email protected]
# with:
# path: ./sbom-output
# name: 'SBOM'
#
# - name: upload spdx dependency
# uses: advanced-security/[email protected]
# with:
# filePath: ./sbom-output/

0 comments on commit 0e72ad3

Please sign in to comment.