Build and Push Docker Image #58
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
| name: Build and Push Docker Image | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Extract version from package.json | |
| id: get_version | |
| run: | | |
| VERSION=$(jq -r .version package.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Log in to Harbor Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ secrets.HARBOR_REGISTRY }} | |
| username: ${{ secrets.HARBOR_USERNAME }} | |
| password: ${{ secrets.HARBOR_PASSWORD }} | |
| - name: Build and push Docker image | |
| run: | | |
| docker build \ | |
| --build-arg NEXT_PUBLIC_DOMAIN_BACKEND=${{ secrets.NEXT_PUBLIC_DOMAIN_BACKEND }} \ | |
| --build-arg NEXT_PUBLIC_PROJECT_ID=${{ secrets.NEXT_PUBLIC_PROJECT_ID }} \ | |
| -t ${{ secrets.HARBOR_REGISTRY }}/fleet/fayevr-dev:${{ steps.get_version.outputs.version }} \ | |
| -t ${{ secrets.HARBOR_REGISTRY }}/fleet/fayevr-dev:latest \ | |
| -f Dockerfile . | |
| docker push ${{ secrets.HARBOR_REGISTRY }}/fleet/fayevr-dev:${{ steps.get_version.outputs.version }} | |
| docker push ${{ secrets.HARBOR_REGISTRY }}/fleet/fayevr-dev:latest |