Skip to content

Update README.md

Update README.md #15

Workflow file for this run

# -----------------------------------------------------------------------------
# πŸ“¦ GitHub Actions: docker-ci.yml
# Purpose: Automatically build and publish Docker images
# on every push to the `main` branch.
# This is a CI/CD workflow (Continuous Integration & Delivery).
#
# What it does:
# 1. Clones the project code.
# 2. Logs into Docker Hub.
# 3. Builds backend and frontend Docker images.
# 4. Pushes these images to Docker Hub.
# -----------------------------------------------------------------------------
name: Docker CI # Workflow name shown on GitHub
on:
push:
branches: [ main ] # πŸ‘‰ Run only when pushing to the "main" branch
jobs:
build: # πŸ‘· Job name
runs-on: ubuntu-latest # πŸ”§ GitHub Actions will run on an Ubuntu VM
steps: # πŸ“‹ Steps executed sequentially
- name: Checkout code # 🧾 Step 1: Clone the repository
uses: actions/checkout@v3 # πŸ“₯ Official GitHub checkout action
- name: Set up Docker Buildx # 🧰 Step 2: Setup Buildx β€” Docker extension for advanced builds
uses: docker/setup-buildx-action@v3 # πŸ“¦ Action to install buildx
- name: Login to Docker Hub # πŸ” Step 3: Authenticate to Docker Hub to push images
uses: docker/login-action@v3 # πŸ›‚ Official login method
with:
username: ${{ secrets.DOCKER_USERNAME }} # πŸ”’ Username from GitHub secrets
password: ${{ secrets.DOCKER_PASSWORD }} # πŸ”’ Password or token from secrets (secure)
- name: Build and push backend # βš™οΈ Step 4: Build and push backend image
uses: docker/build-push-action@v5 # πŸ› οΈ Build and push Docker images
with:
context: ./backend # πŸ“ Build context β€” backend folder
tags: ${{ secrets.DOCKER_USERNAME }}/flask-api:latest # 🏷️ Image name: dockerhub_user/flask-api
push: true # πŸ“€ Push the image after build
- name: Build and push frontend # βš™οΈ Step 5: Build and push frontend image
uses: docker/build-push-action@v5 # πŸ› οΈ Same as above, for frontend
with:
context: ./frontend # πŸ“ Build context β€” frontend folder
tags: ${{ secrets.DOCKER_USERNAME }}/node-frontend:latest # 🏷️ Image name: dockerhub_user/node-frontend
push: true # πŸ“€ Push the image to Docker Hub
- name: Build and push nginx # βš™οΈ Step 6: Build and push nginx image
uses: docker/build-push-action@v5 # πŸ› οΈ Same, for nginx
with:
context: ./nginx # πŸ“ Build context β€” nginx folder
tags: ${{ secrets.DOCKER_USERNAME }}/nginx:latest # 🏷️ Image name: dockerhub_user/nginx
push: true # πŸ“€ Push the image to Docker Hub