Added workflow and dockerfile
All checks were successful
Build and Push Docker Image / build (push) Successful in 57s

This commit is contained in:
2024-12-12 12:35:13 +00:00
parent 3c2867ea87
commit 3c1a6e9ce0
10 changed files with 76 additions and 12 deletions

View File

@ -0,0 +1,34 @@
name: Build and Push Docker Image
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest # Use Ubuntu as the runner environment
steps:
- name: Checkout code
uses: actions/checkout@v3 # Checkout the repository's code
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }} # Docker Hub username from GitHub Secrets
password: ${{ secrets.DOCKER_PASSWORD }} # Docker Hub password from GitHub Secrets
- name: Build Docker image
run: |
# Build the Docker image from the Dockerfile in the repo
docker build -t ${{ secrets.DOCKER_USERNAME }}/divine-couture.co.uk:latest .
- name: Push Docker image to Docker Hub
run: |
# Push the Docker image to Docker Hub
docker push ${{ secrets.DOCKER_USERNAME }}/divine-couture.co.uk:latest
- name: Logout from Docker Hub
run: docker logout