From: js6pak Date: Tue, 16 Mar 2021 20:40:54 +0000 (+0100) Subject: Update docker CI X-Git-Tag: v1.3.0~7 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=e0041e89d8f6d21702de645545ec72207235ecae;p=rhonda%2Fimpostor.git Update docker CI --- diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b312075..5cc0db2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,7 @@ name: Docker on: push: - branches: dev + branches: master paths: - 'src/Impostor.Server/**' - 'src/Impostor.Shared/**' @@ -33,15 +33,16 @@ jobs: run: | DOCKER_IMAGE=aeonlucid/impostor VERSION=noop + VERSIONSUFFIX=docker if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} + VERSIONSUFFIX= elif [[ $GITHUB_REF == refs/heads/* ]]; then - VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') - if [ "${{ github.event.repository.default_branch }}" = "dev" ]; then - VERSION=nightly - fi + VERSION=nightly + VERSIONSUFFIX=docker.${{ github.run_number }} elif [[ $GITHUB_REF == refs/pull/* ]]; then VERSION=pr-${{ github.event.number }} + VERSIONSUFFIX=pr.${{ github.event.number }} fi TAGS="${DOCKER_IMAGE}:${VERSION}" if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then @@ -49,6 +50,7 @@ jobs: fi echo ::set-output name=version::${VERSION} echo ::set-output name=tags::${TAGS} + echo ::set-output name=versionsuffix::${VERSIONSUFFIX} echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -68,3 +70,5 @@ jobs: platforms: linux/amd64,linux/arm/v7,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.prep.outputs.tags }} + build-args: | + VERSIONSUFFIX=${{ steps.prep.outputs.versionsuffix }} diff --git a/Dockerfile b/Dockerfile index 8f386da..932addb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build # https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17 ARG TARGETARCH +ARG VERSIONSUFFIX + WORKDIR /source # Copy csproj and restore. @@ -29,7 +31,7 @@ RUN case "$TARGETARCH" in \ arm) NETCORE_PLATFORM='linux-arm';; \ *) echo "unsupported architecture"; exit 1 ;; \ esac && \ - dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" --no-restore ./src/Impostor.Server/Impostor.Server.csproj + dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" -p:VersionSuffix="$VERSIONSUFFIX" --no-restore ./src/Impostor.Server/Impostor.Server.csproj # Final image. FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:5.0