Merge pull request #403 from MPCoreDeveloper/feat/aspire-server-hosting #1
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: Docker | |
| on: | |
| push: | |
| tags: [ 'v*' ] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ghcr.io/mpcoredeveloper/sharpcoredb-server | |
| jobs: | |
| build-and-push: | |
| name: Build & push SharpCoreDB server image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Compute image tags | |
| id: meta | |
| shell: pwsh | |
| run: | | |
| $version = if ("${{ github.ref_type }}" -eq 'tag') { "${{ github.ref_name }}".TrimStart('v') } else { "${{ github.sha }}".Substring(0, 7) } | |
| $tags = @("${{ env.IMAGE_NAME }}:$version") | |
| if ("${{ github.ref_type }}" -eq 'tag') { | |
| $tags += "${{ env.IMAGE_NAME }}:latest" | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "Tags: $($tags -join ', ')" | |
| "version=$version" >> $env:GITHUB_OUTPUT | |
| "tags=$($tags -join ',')" >> $env:GITHUB_OUTPUT | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 | |
| with: | |
| context: . | |
| file: src/SharpCoreDB.Server/Dockerfile | |
| push: true | |
| platforms: linux/amd64, linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| build-args: | | |
| VERSION=${{ steps.meta.outputs.version }} | |
| labels: | | |
| org.opencontainers.image.title=SharpCoreDB Server | |
| org.opencontainers.image.description=SharpCoreDB network database server (gRPC + HTTPS) | |
| org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} | |
| org.opencontainers.image.version=${{ steps.meta.outputs.version }} | |
| org.opencontainers.image.revision=${{ github.sha }} |