Skip to content

Build and Push Docker Image #1

Build and Push Docker Image

Build and Push Docker Image #1

name: Build and Push Docker Image
on:
workflow_dispatch:
release:
types: [created]
env:
REGISTRY: docker.pkg.github.com
IMAGE_NAME: ${{ github.repository }}
TAG: latest
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}