Trying to fix github actions fails #25
Workflow file for this run
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 Images | |
| on: | |
| push: | |
| branches: | |
| - github-actions | |
| pull_request: | |
| branches: | |
| - github-actions | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_OWNER: ${{ github.repository_owner }} | |
| jobs: | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| # --------------------------- | |
| # Checkout code | |
| # --------------------------- | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # --------------------------- | |
| # Set up JDK 21 | |
| # --------------------------- | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| # --------------------------- | |
| # Cache Maven dependencies | |
| # --------------------------- | |
| - name: Cache Maven packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| # --------------------------- | |
| # Log in to GHCR | |
| # --------------------------- | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.CR_PAT }} | |
| # --------------------------- | |
| # Build shared module | |
| # --------------------------- | |
| - name: Build and install microservice-shared | |
| run: mvn clean install -DskipTests | |
| working-directory: ./microservice-shared | |
| # --------------------------- | |
| # Backend service | |
| # --------------------------- | |
| - name: Build backend JAR | |
| run: mvn clean package -DskipTests | |
| working-directory: ./backend | |
| - name: Build & push backend Docker | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-backend:latest --file ./backend/Dockerfile ./backend | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-backend:latest | |
| # --------------------------- | |
| # Microservice Notifications | |
| # --------------------------- | |
| - name: Build microservice-notifications JAR | |
| run: mvn clean package -DskipTests | |
| working-directory: ./microservice-notifications | |
| - name: Build & push notifications Docker | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-notifications:latest --file ./microservice-notifications/Dockerfile ./microservice-notifications | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-notifications:latest | |
| # --------------------------- | |
| # Microservice Chat | |
| # --------------------------- | |
| - name: Build microservice-chat JAR | |
| run: mvn clean package -DskipTests | |
| working-directory: ./microservice-chat | |
| - name: Build & push chat Docker | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-chat:latest --file ./microservice-chat/Dockerfile ./microservice-chat | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-chat:latest | |
| # --------------------------- | |
| # Frontend | |
| # --------------------------- | |
| - name: Build & push frontend Docker | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-frontend:latest ./frontend --build-arg REACT_APP_API_BASE_URL=http://localhost:8080 | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-frontend:latest | |
| # --------------------------- | |
| # Microservice Moderation | |
| # --------------------------- | |
| - name: Build & push microservice-moderation Docker images | |
| run: | | |
| for service in classical bert toxic_bert llm api; do | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/moderation-$service:latest ./microservice-moderation --file docker/$service/Dockerfile | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/moderation-$service:latest | |
| done |