Build and Push Docker Image #16
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 and Push Docker Image | |
on: | |
release: | |
types: [created] | |
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 "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV | |
- 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 }}/f7t4jhub:${{ env.APP_VERSION }}-fcs${{ github.event.release.tag_name }} -f dockerfiles/Dockerfile . | |
- name: Push Docker image to GitHub Container Registry | |
run: docker push ghcr.io/${{ github.repository_owner }}/f7t4jhub:${{ env.APP_VERSION }}-fcs${{ github.event.release.tag_name }} |