Updated mock event generation to match dark events. #91
Workflow file for this run
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: Docker build | |
# This workflow is triggered by pull request actions such as opened, synchronized, or reopened | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
# Defines a job to build (and optionally push) Docker images which we dont push the images in this workflow to avoid multiple builds on Docker hub | |
build: | |
# Specifies that the job runs on the latest version of Ubuntu | |
runs-on: ubuntu-latest | |
# Uses a matrix strategy for running builds across multiple components in parallel | |
strategy: | |
matrix: | |
component: ['api', 'keycloak'] # Components to be built | |
# Environment variables to be used across all steps | |
env: | |
# Cleans the branch name to be used as Docker tag, using the commit SHA if the branch name is not available | |
CLEAN_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
DOCKER_TAG: ${{ (github.head_ref || github.ref_name) == '' && github.sha || (github.head_ref || github.ref_name) }} | |
steps: | |
# Step 1: Checks out the repository code including submodules | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' # Ensures all git submodules are checked out | |
# Step 2: Sets up Docker Buildx for advanced Docker builds | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Step 3: Logs in to DockerHub to allow pushing images (if needed) | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} # DockerHub username from secrets | |
password: ${{ secrets.DOCKERHUB_TOKEN }} # DockerHub token from secrets | |
# Step 4: Sanitizes the branch or commit SHA to be a valid Docker tag | |
- name: Sanitize Reference Name for Docker Tag | |
run: echo "DOCKER_TAG=$(echo $DOCKER_TAG | sed 's|/|-|g' | sed 's|[^a-zA-Z0-9_.-]|-|g')" >> $GITHUB_ENV | |
# Step 5: Builds the Docker image but does not push it to DockerHub | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./${{ matrix.component }} # Specifies the directory as the Docker context | |
file: ./${{ matrix.component }}/Dockerfile # Path to the Dockerfile | |
push: false # Does not push the built image to DockerHub | |
tags: usdotjpoode/jpo-conflictvisualizer-${{ matrix.component }}:${{ env.DOCKER_TAG }} # Tags the built image |