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:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Get current date
run: echo "BUNDLE_DATE=$(date +"%Y-%m-%d_%H-%M-%S")" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/${{ env.REPO }}:latest
ghcr.io/${{ env.REPO }}:${{ env.BUNDLE_DATE }}