Skip to content

Commit

Permalink
Create push-docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rsarm authored May 29, 2024
1 parent 0424e84 commit 1852133
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
workflow_dispatch: # Allows manual triggering

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get version from Chart.yaml
run: |
APP_VERSION=$(grep appVersion chart/Chart.yaml | cut -d ' ' -f 2 | tr -d '"')
echo "::set-env name=APP_VERSION::$APP_VERSION"
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
run: docker build -t ghcr.io/${{ github.repository_owner }}/${{ github.repository_name }}:${{ env.APP_VERSION }} -f dockerfiles/Dockerfile .

- name: Push Docker image to GitHub Container Registry
run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository_name }}:${{ env.APP_VERSION }}

0 comments on commit 1852133

Please sign in to comment.