diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76f4a36c36..89b4c0624b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -175,3 +175,50 @@ jobs: run: | docker buildx build --push --tag ghcr.io/particular/${{ matrix.name }}:${{ env.TAG_NAME }} --file src/${{ matrix.project }}/Dockerfile --build-arg VERSION=${{ env.MinVerVersion }} --platform linux/arm64,linux/arm,linux/amd64 . docker buildx imagetools inspect ghcr.io/particular/${{ matrix.name }}:${{ env.TAG_NAME }} + db-containers: + if: ${{ github.actor != 'dependabot[bot]' }} + runs-on: ubuntu-22.04 + name: db-containers + defaults: + run: + shell: bash + steps: + - name: Check for secrets + env: + SECRETS_AVAILABLE: ${{ secrets.SECRETS_AVAILABLE }} + shell: pwsh + run: exit $(If ($env:SECRETS_AVAILABLE -eq 'true') { 0 } Else { 1 }) + - name: Checkout + uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - name: Install MinVer CLI + run: dotnet tool install --global minver-cli + - name: Determine versions + run: echo "MinVerVersion=$(minver)" >> $GITHUB_ENV + - name: Log in to GitHub container registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Build images + env: + TAG_NAME: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || env.MinVerVersion }} + shell: pwsh + run: | + Write-Output "Determining RavenDB version from Directory.Packages.props file" + [xml]$packagesFile = Get-Content src/Directory.Packages.props + $RavenVersion = $packagesFile.selectNodes("//Project/ItemGroup/PackageVersion[@Include='RavenDB.Embedded']").Version + + if (-not $RavenVersion) { throw "Unable to determine RavenDB server version from Directory.Packages.props" } + + Write-Output "Determining container variants to build" + $containers = cat src/ServiceControl.RavenDB/containers.json | ConvertFrom-Json + $containers | ForEach-Object -Process { + $FULLTAG="${{ env.TAG_NAME }}-$($_.tag)" + $BASETAG="$($RavenVersion)-ubuntu.22.04-$($_.tag)" + Write-Output "::group::Building $FULLTAG for architecture $($_.arch) from $BASETAG" + docker build -t ghcr.io/particular/servicecontrol-ravendb:$FULLTAG --file src/ServiceControl.RavenDB/Dockerfile --build-arg VERSION=${{ env.MinVerVersion }} --build-arg BASETAG=$BASETAG --platform linux/$($_.arch) . + Write-Output "::endgroup::" + } + - name: List local images + run: docker images + - name: Push images to GitHub Container registry + run: docker image push --all-tags ghcr.io/particular/servicecontrol-ravendb diff --git a/src/ServiceControl.RavenDB/Dockerfile b/src/ServiceControl.RavenDB/Dockerfile new file mode 100644 index 0000000000..08ca5377cd --- /dev/null +++ b/src/ServiceControl.RavenDB/Dockerfile @@ -0,0 +1,15 @@ +ARG BASETAG +ARG VERSION +FROM ravendb/ravendb:$BASETAG AS ravendb + +COPY src/ServiceControl.Persistence.RavenDB/RavenLicense.json /opt/RavenDB/servicecontrol-license.json + +ENV RAVEN_ARGS='--License.Eula.Accepted=true --License.Path=/opt/RavenDB/servicecontrol-license.json' + +LABEL org.opencontainers.image.source=https://github.com/Particular/ServiceControl \ + org.opencontainers.image.authors="Particular Software" \ + org.opencontainers.image.url=https://docs.particular.net/servicecontrol/ \ + org.opencontainers.image.documentation=https://docs.particular.net/servicecontrol/ \ + org.opencontainers.image.version=$VERSION \ + org.opencontainers.image.title=ServiceControl.RavenDB \ + org.opencontainers.image.description="ServiceControl database storage using RavenDB" diff --git a/src/ServiceControl.RavenDB/containers.json b/src/ServiceControl.RavenDB/containers.json new file mode 100644 index 0000000000..ddacc822ba --- /dev/null +++ b/src/ServiceControl.RavenDB/containers.json @@ -0,0 +1,14 @@ +[ + { + "arch": "amd64", + "tag": "x64" + }, + { + "arch": "arm64/v8", + "tag": "arm64v8" + }, + { + "arch": "arm/v7", + "tag": "arm32v7" + } +] \ No newline at end of file