All checks were successful
Build and Push Docker Image / build (push) Successful in 57s
34 lines
1003 B
YAML
34 lines
1003 B
YAML
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 |