From f1c700ba8f099be7587c0487d2ad7987a1c36b1b Mon Sep 17 00:00:00 2001 From: Josh Creek Date: Sun, 29 Aug 2021 15:37:54 +0100 Subject: [PATCH] feat(*): Add docker files --- YouTubeChannelDownloader/Dockerfile | 26 ++++++++++++++++++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 YouTubeChannelDownloader/Dockerfile create mode 100644 docker-compose.yml diff --git a/YouTubeChannelDownloader/Dockerfile b/YouTubeChannelDownloader/Dockerfile new file mode 100644 index 0000000..b46e87b --- /dev/null +++ b/YouTubeChannelDownloader/Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/dotnet/runtime:5.0-focal AS base + +# Install FFmpeg +RUN apt-get -y update +RUN apt-get -y upgrade +RUN apt-get install -y ffmpeg + +# Copy fresh db to root +COPY ["YouTubeChannelDownloader/db/downloadedvideos.sqlite", "db/"] + + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["YouTubeChannelDownloader/YouTubeChannelDownloader.csproj", "YouTubeChannelDownloader/"] +RUN dotnet restore "YouTubeChannelDownloader/YouTubeChannelDownloader.csproj" --disable-parallel +COPY . . +WORKDIR "/src/YouTubeChannelDownloader" +RUN dotnet build "YouTubeChannelDownloader.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "YouTubeChannelDownloader.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "YouTubeChannelDownloader.dll"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4a4b6f3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.4' + +services: + youtubechanneldownloader: + container_name: youtubechanneldownloader + build: + context: . + dockerfile: YouTubeChannelDownloader/Dockerfile + network: host # No need for its own network interface, just share the host's for full download speeds + volumes: + - ./YouTubeChannelDownloader/db:/db + - ./YouTubeChannelDownloader/logs:/app/logs + environment: + - ASPNETCORE_ENVIRONMENT=Production + - CHANNEL_ID= # Find these by viewing the source html of the channel page and searching for 'externalid' + - SFTP_HOST= + - SFTP_PORT=22 + - SFTP_USER= + - SFTP_PASSWORD= + - SFTP_DESTINATIONFOLDER= # in the form /foldername \ No newline at end of file