Update argocd-app.yaml #275
This file contains 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
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 |