From 0c2ad0058efab35b103e44c1fd4fddc05540a167 Mon Sep 17 00:00:00 2001 From: nezu <29180158+dumbasPL@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:53:49 +0000 Subject: [PATCH 1/5] Add Dockerfile and CI for Docker --- .dockerignore | 9 ++++ .github/workflows/build-docker.yml | 75 ++++++++++++++++++++++++++++++ Dockerfile | 21 +++++++++ 3 files changed, 105 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/build-docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..1543cd3c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +# directories +**/bin/ +**/obj/ +**/out/ + +# files +Dockerfile* +**/*.trx +**/*.md diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..1a49e3f2 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,75 @@ +name: Docker CI + +on: + workflow_dispatch: + push: + branches: + - 'master' + tags: + - 'v*' + paths-ignore: + - '.github/*' + - '.github/*_TEMPLATE/**' + - '*.md' + pull_request: + branches: + - 'master' + paths-ignore: + - '.github/*' + - '.github/*_TEMPLATE/**' + - '*.md' + +jobs: + build: + name: Docker image + runs-on: ubuntu-latest + env: + DOCKER_USERNAME: "dumbasPL" + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: amd64,arm64,arm + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.DOCKER_USERNAME }}/DepotDownloader + ghcr.io/${{ env.DOCKER_USERNAME }}/DepotDownloader + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bb2e89ff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build + +ENV DOTNET_CLI_TELEMETRY_OPTOUT=true + +WORKDIR /DepotDownloader + +COPY ./ ./ + +RUN dotnet restore + +RUN dotnet publish -c Release -o out + +FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine + +ENV DOTNET_CLI_TELEMETRY_OPTOUT=true + +WORKDIR /DepotDownloader + +COPY --from=build /DepotDownloader/out . + +ENTRYPOINT ["dotnet", "DepotDownloader.dll"] From cd89f6f9b862373a73d2892cdf650010b53ad375 Mon Sep 17 00:00:00 2001 From: nezu <29180158+dumbasPL@users.noreply.github.com> Date: Sat, 1 Apr 2023 17:03:55 +0000 Subject: [PATCH 2/5] Add more Docker architectures --- .github/workflows/build-docker.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 1a49e3f2..90e1171c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -29,9 +29,11 @@ jobs: - uses: actions/checkout@v3 - name: Set up QEMU + id: qemu uses: docker/setup-qemu-action@v2 with: - platforms: amd64,arm64,arm + # architectures supported by the .NET runtime + platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -72,4 +74,4 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - + platforms: ${{ steps.qemu.platforms }} From 184206334e9dd6b19b22223278b31323dde97095 Mon Sep 17 00:00:00 2001 From: nezu <29180158+dumbasPL@users.noreply.github.com> Date: Sat, 1 Apr 2023 17:10:08 +0000 Subject: [PATCH 3/5] Fix docker platforms --- .github/workflows/build-docker.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 90e1171c..f25a1025 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -29,11 +29,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up QEMU - id: qemu uses: docker/setup-qemu-action@v2 - with: - # architectures supported by the .NET runtime - platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -74,4 +70,4 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: ${{ steps.qemu.platforms }} + platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 From 00013e2785d87c56ce8006fdf4b4f90cf95132cf Mon Sep 17 00:00:00 2001 From: nezu <29180158+dumbasPL@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:37:56 +0000 Subject: [PATCH 4/5] Remove multi-platform builds As it turns out building .NET is not yet ready for this. Once this matures we can add it back. more info: https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/ --- .github/workflows/build-docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f25a1025..253c44fc 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -28,8 +28,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -70,4 +70,4 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 + # platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 From 136c960ee2d121dd6e8f684bdc73babf2e942370 Mon Sep 17 00:00:00 2001 From: nezu <29180158+dumbasPL@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:54:13 +0000 Subject: [PATCH 5/5] rename DOCKER_USERNAME to SteamRE --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 253c44fc..3edfac7e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -24,7 +24,7 @@ jobs: name: Docker image runs-on: ubuntu-latest env: - DOCKER_USERNAME: "dumbasPL" + DOCKER_USERNAME: "SteamRE" steps: - uses: actions/checkout@v3