Skip to content

Commit

Permalink
docker image building and publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sunu committed Aug 10, 2024
1 parent fb07433 commit 4dd74c7
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and push container image

on:
workflow_dispatch:
push:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: sunu/nfs-ganesha

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Build and push container image
uses: docker/build-push-action@v6
with:
context: ./nfs-ganesha
file: ./nfs-ganesha/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:{{ github.sha }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: org.opencontainers.image.source="${{ github.repository }}"

0 comments on commit 4dd74c7

Please sign in to comment.