Merge pull request #80 from nootey/development #234
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 Docker Image" | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'deployments/**' | |
| - '*.md' | |
| branches: | |
| - main | |
| - development | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build a API Docker image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: go-build-cache | |
| key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} | |
| - name: inject go-build-cache into docker | |
| uses: reproducible-containers/buildkit-cache-dance@v3.3.0 | |
| with: | |
| cache-map: | | |
| { | |
| "go-build-cache": "/root/.cache/go-build" | |
| } | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Generate Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| nootey/wealth-warden | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,event=pr | |
| flavor: | | |
| latest=true | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: runtime | |
| file: ./build/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ steps.meta.outputs.version }} | |
| COMMIT_SHA=${{ github.sha }} | |
| BUILD_TIME=${{ github.event.repository.updated_at }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-client: | |
| name: Build a Client Docker image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Generate Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| nootey/wealth-warden-client | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,event=pr | |
| flavor: | | |
| latest=true | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./build/Dockerfile.client | |
| platforms: ${{ matrix.platform }} | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ steps.meta.outputs.version }} | |
| COMMIT_SHA=${{ github.sha }} | |
| BUILD_TIME=${{ github.event.repository.updated_at }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |