[DEV-13666] Fixing ci flow for building images #6
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 Images | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
- DEV-13666-build-images | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- dockerfile: Dockerfile.sdk-react | |
image_name: sdk-react | |
- dockerfile: Dockerfile.sdk-demo-with-nextjs-and-clerk-auth | |
image_name: sdk-demo-with-nextjs-and-clerk-auth | |
- dockerfile: Dockerfile.sdk-demo | |
image_name: sdk-demo | |
- dockerfile: Dockerfile.sdk-demo-nginx | |
image_name: sdk-demo-nginx | |
- dockerfile: Dockerfile.sdk-drop-in | |
image_name: sdk-drop-in | |
- dockerfile: Dockerfile.sdk-drop-in-nginx | |
image_name: sdk-drop-in-nginx | |
- dockerfile: Dockerfile.private-registry | |
image_name: private-registry | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Log in to GitLab Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.monite.com | |
username: ${{ vars.GITLAB_BOT_USERNAME }} | |
password: ${{ secrets.GITLAB_BOT_ACCESS_TOKEN }} | |
- name: Build and push Docker image to GitLab | |
run: | | |
COMMIT_SHA=${{ github.sha }} | |
IMAGE_TAG=${{ matrix.image_name }}-${COMMIT_SHA} | |
docker build -t registry.monite.com/monite/frontend/sdkapp:${IMAGE_TAG} -f ./${{ matrix.dockerfile }} . | |
docker push registry.monite.com/monite/frontend/sdkapp:${IMAGE_TAG} | |
- name: Output Image Tag | |
run: | | |
echo "Image built and pushed: registry.monite.com/monite/frontend/sdkapp:${{ matrix.image_name }}-${{ github.sha }}" |