Skip to content

Update deployment.yaml #282

Update deployment.yaml

Update deployment.yaml #282

Workflow file for this run

name: Build and Push Docker Image to Docker Hub
on:
push:
branches:
- main # Adjust this if you're using a different branch
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the code from your repository
- name: Checkout code
uses: actions/checkout@v2
# Step 2: Set up Docker Buildx for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Log in to Docker Hub using the stored secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
# Step 4: Set the Image Tag using the current date and time (for unique versioning)
- name: Set image tag
run: echo "IMAGE_TAG=$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV
# Step 5: Build and push the Docker image to Docker Hub (multi-platform build)
- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
jakehazex21/my-nginx-app:${{ env.IMAGE_TAG }}
jakehazex21/my-nginx-app:latest
# Step 7: Log out from Docker Hub
- name: Log out from Docker Hub
run: docker logout