Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #406

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# directories
**/bin/
**/obj/
**/out/

# files
Dockerfile*
**/*.trx
**/*.md
73 changes: 73 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Docker CI

on:
workflow_dispatch:
push:
branches:
- 'master'
tags:
- 'v*'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our releases are usually tagged as DepotDownloader_*.

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: "SteamRE"
steps:
- uses: actions/checkout@v3

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

- 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 }}
# platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]