Corrected paths in documentation #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ----------------------------------------------------------------------------- | |
| # π¦ 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 |