Skip to content

Build and Push Docker Image #1

Build and Push Docker Image

Build and Push Docker Image #1

Workflow file for this run

name: Build and Push Docker Image
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
docker buildx build --platform linux/amd64 -f .docker/Dockerfile -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest .
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest