lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.76k stars 262 forks source link

CLI: Docker Image #1250

Open MoergJ opened 1 week ago

MoergJ commented 1 week ago

Checklist

Write your feature request here

I found this project today, played around and took a few minutes to build a Dockerfile. It works for me, but I don't have the time to create a PR or continuously contribute, so just in case someone needs a simple but working Docker image for the CLI (x64, not ARM) here it is.

# Build binaries
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /App
# Copy projects
COPY ./TwitchDownloaderCore ./TwitchDownloaderCore
COPY ./TwitchDownloaderCLI ./TwitchDownloaderCLI
# Restore
RUN dotnet restore TwitchDownloaderCLI
# Build and publish
RUN dotnet publish TwitchDownloaderCLI -p:PublishProfile=Linux -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /App
# Copy built Binary
COPY --from=build /App/out/TwitchDownloaderCLI .
# Let TwitchDownloaderCLI download FFMPEG
RUN ./TwitchDownloaderCLI ffmpeg -d
ENTRYPOINT ["./TwitchDownloaderCLI"]

Put in the repo's root and built using docker build -t <image name>:<tag> .

superbonaci commented 1 week ago

What's the point of this?

MoergJ commented 1 week ago

What's the point of this?

To have a short lived container run the CLI command you want it to, without having to install the CLI on the host itself. Could be further used for larger orchestration of download jobs, e.g. I was looking to see, if I could use it to backup channels I frequently watch continuously.

Or did I misunderstand your question?

superbonaci commented 1 week ago

I get it, it's like venv in python. You should improve the docker file to include all architectures and for Windows the UI.

MoergJ commented 1 week ago

I get it, it's like venv in python. You should improve the docker file to include all architectures and for Windows the UI.

It is not exactly like that. Containers are mainly linux based, other platforms like windows are technically possible, but rarely ever used. It is especially useful in server deployed services. The UI, as I understood it (haven't used it yet) is a WPF application, which is not suited to be placed inside a container.

If it was a web based service, that would perfectly make sense.