From 4c3c3270a1a8ab2d494201aab28dfdd6683990cf Mon Sep 17 00:00:00 2001 From: Aram Date: Mon, 14 Oct 2024 20:44:21 +0400 Subject: [PATCH] Rename job to 'qa' and update Dockerfile base images --- .github/workflows/api.yml | 63 +++++++++++++++++++++------------------ src/Argon.Api/Dockerfile | 4 +-- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 6f505698..fad1b17b 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -11,8 +11,7 @@ on: - 'src/Argon.Api/**' jobs: - build: -# if: github.ref == 'refs/heads/master' + qa: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,30 +19,36 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v1 - with: - registry: ${{ secrets.REGISTRY }} - username: ${{ secrets.CR_USER }} - password: ${{ secrets.CR_PWD }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./src/Argon.Api/Dockerfile - push: true - tags: reg.staging.svck.dev/argon/api-orleans:${{ github.run_number }} - platforms: linux/arm64/v8 - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file + build: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + needs: qa + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.CR_USER }} + password: ${{ secrets.CR_PWD }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./src/Argon.Api/Dockerfile + push: true + tags: reg.staging.svck.dev/argon/api-orleans:${{ github.run_number }} + platforms: linux/arm64/v8 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + \ No newline at end of file diff --git a/src/Argon.Api/Dockerfile b/src/Argon.Api/Dockerfile index c762dfd3..9e43afab 100644 --- a/src/Argon.Api/Dockerfile +++ b/src/Argon.Api/Dockerfile @@ -1,10 +1,10 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.18-arm64v8 AS base +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-arm64v8 AS base USER $APP_UID WORKDIR /app EXPOSE 8080 EXPOSE 8081 -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine3.18-arm64v8 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine-arm64v8 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["src/Argon.Api/Argon.Api.csproj", "src/Argon.Api/"]