feat: update logging configuration and enhance Docker setup for api_g… #16
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: [ dev, master ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DOCKER_REGISTRY: docker.io | |
| DOCKER_REPOSITORY: marcofontana17/cce_prototipo | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| name: Build and Push Docker Images | |
| strategy: | |
| matrix: | |
| service: | |
| - name: "api_gateway" | |
| dockerfile: "./api_gateway/Dockerfile" | |
| suffix: "api_gateway" | |
| - name: "service" | |
| dockerfile: "./service/Dockerfile" | |
| suffix: "service" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Extract metadata for ${{ matrix.service.name }} | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.DOCKER_REPOSITORY }} | |
| tags: | | |
| type=raw,value=${{ matrix.service.suffix }}-latest,enable=${{ github.ref == 'refs/heads/master' }} | |
| type=raw,value=${{ matrix.service.suffix }}-dev-latest,enable=${{ github.ref == 'refs/heads/dev' }} | |
| type=sha,prefix=${{ github.ref_name }}-,suffix=-${{ matrix.service.suffix }} | |
| - name: Build and push ${{ matrix.service.name }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ${{ matrix.service.dockerfile }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |