Skip to content

Update docker-image.yml #9

Update docker-image.yml

Update docker-image.yml #9

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main # Trigger the action on pushes to the main branch
pull_request:
branches:
- main # Trigger the action on pull requests to the main branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build --tag ${{ secrets.DOCKER_USERNAME }}/webportfolio:latest .
# Step 5: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Step 6: Push the Docker image to Docker Hub
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/webportfolio:latest