Build and Push Container #51
Workflow file for this run
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 Container | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'Dockerfile' | |
- 'requirements.txt' | |
- 'requirements.yml' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Image Tag' | |
required: true | |
default: 'latest' | |
env: | |
TAG: ghcr.io/${{ github.repository }}:latest | |
jobs: | |
push-and-tag: | |
name: Deploy containers to GHCR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking out the repository | |
uses: actions/checkout@v2 | |
- name: Build Container | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile | |
load: true | |
tags: ${{ env.TAG }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.MDD_GITHUB_ACTION_USERNAME }} | |
password: ${{ secrets.MDD_GITHUB_ACTION_TOKEN }} | |
- name: Push Container | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.TAG }} | |
if: ${{ ! inputs.tag }} | |
- name: Push Container | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ inputs.tag }} | |
if: ${{ inputs.tag }} |