Merge pull request #12 from ismiljanic/dev #20
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: | |
| - main | |
| - dev | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_OWNER: ${{ github.repository_owner }} | |
| jobs: | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.CR_PAT }} | |
| - name: Build and install microservice-shared | |
| run: mvn clean install -DskipTests | |
| working-directory: ./microservice-shared | |
| - name: Build and push backend | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-backend:latest ./backend | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-backend:latest | |
| - name: Build microservice-notifications JAR | |
| run: mvn clean package -DskipTests | |
| working-directory: ./microservice-notifications | |
| - name: Build and push microservice-notifications | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-notifications:latest ./microservice-notifications | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-notifications:latest | |
| - name: Build microservice-chat JAR | |
| run: mvn clean package -DskipTests | |
| working-directory: ./microservice-chat | |
| - name: Build and push microservice-chat | |
| run: | | |
| docker build -t $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-chat:latest ./microservice-chat | |
| docker push $REGISTRY/${{ env.IMAGE_OWNER }}/syntaxbase-chat:latest | |
| - name: Build and push frontend | |
| 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 |