Skip to content

Build and Push TrainingPortal Image #7

Build and Push TrainingPortal Image

Build and Push TrainingPortal Image #7

name: Build and Push TrainingPortal Image
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Prepare Repo Name
id: prep-repo-name
run: |
echo "IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: trainingportal/
file: ./Dockerfile.trainingportal
push: true
tags: ghcr.io/${{ steps.prep-repo-name.outputs.IMAGE_REPOSITORY }}:${{ github.sha }}