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

# Pipeline to build and push Docker image to Docker Hub when there are changes in the main branch
# Going to use actions from -> https://github.com/marketplace?query=docker
name: Docker Build and Push Docker Image
run-name: Build and Push Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout
uses: actions/checkout@v4
# Ubuntu-latest has Docker pre-installed
# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}} # Docker Hub username
password: ${{secrets.DOCKER_PASSWORD}} # Docker Hub password
# Build the Docker image
- name: Build & Push the Docker Image
uses: docker/build-push-action@v6
with:
push: true
tags: itzzjb/docker-react:latest