add docker image build #1
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 Harbor | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Log in to Harbor | |
- name: Log in to Harbor Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: harbor.fayevr.dev | |
username: ${{ secrets.HARBOR_USERNAME }} | |
password: ${{ secrets.HARBOR_PASSWORD }} | |
# Step 3: Build and push Docker image | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t harbor.fayevr.dev/fleet/nextjs-app:latest . | |
docker push harbor.fayevr.dev/fleet/nextjs-app:latest |