Skip to content
name: Docker-Build and Push Docker Image to DockerHub
# bugfix
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Log in to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build the Docker image
- name: Build the Docker image
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/jul24-petclinic:latest -f app/dockerfile-app app/
# Push the Docker image to DockerHub
- name: Push the Docker image
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/jul24-petclinic:latest