From dca5326b4e2f0a940b793961f39918b129582300 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 18 Apr 2021 13:31:35 +0200 Subject: [PATCH] YoutubeDL container efficiency upgrades (#381) * try some youtubedl restructuring * Some more restructure * hadolint --- .containers/apps/youtubedl/Dockerfile | 52 +++++++++++++++++---------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/.containers/apps/youtubedl/Dockerfile b/.containers/apps/youtubedl/Dockerfile index 90a0312d5a5..dfd6355bd80 100644 --- a/.containers/apps/youtubedl/Dockerfile +++ b/.containers/apps/youtubedl/Dockerfile @@ -1,31 +1,40 @@ # hadolint ignore=DL3007 FROM ghcr.io/truecharts/ubuntu:latest AS builder -ARG VERSION -WORKDIR /app +WORKDIR /extract/build # hadolint ignore=DL3002 USER root +ARG VERSION +ENV VERSION=4.2 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=DL3008,DL3015,SC2086,SC2155,DL3003,DL3016 RUN \ apt-get -qq update \ && \ apt-get -qq install -y \ - nodejs \ - unzip \ - python \ - npm \ - && \ - export URL="https://github.com/Tzahi12345/YoutubeDL-Material/releases/download/v${VERSION}/youtubedl-material-v${VERSION}.zip" \ - && curl -fsSL -o /tmp/youtubedl.zip "${URL}" \ - && unzip /tmp/youtubedl.zip -d /tmp \ - && cp -Rf /tmp/youtubedl-material/* /app \ - && printf "UpdateMethod=docker\nPackageVersion=%s\nPackageAuthor=[TrueCharts Project](https://truecharts.org)" "${VERSION}" > /app/package_info \ - && echo "==running NPM install==" \ - && npm install + npm + +# hadolint ignore=DL3016 +RUN npm install -g @angular/cli + +RUN \ + export URL="https://github.com/Tzahi12345/YoutubeDL-Material/archive/refs/tags/v${VERSION}.tar.gz" \ + && curl -fsSL -o /tmp/youtubedl.tgz "${URL}" \ + && tar ixzf /tmp/youtubedl.tgz -C /extract --strip-components=1 \ + && cp /extract/package.json /extract/package-lock.json /extract/build + +# hadolint ignore=DL3016 +RUN \ + echo "==running NPM install==" \ + && npm install \ + && cp /extract/angular.json /extract/tsconfig.json /extract/build \ + && cp -Rf /extract/src /extract/build \ + && ng build --prod + # hadolint ignore=DL3007 FROM ghcr.io/truecharts/ubuntu:latest @@ -45,19 +54,26 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG VERSION +WORKDIR /app +COPY --chown=apps:apps --from=builder [ "/extract/backend/package.json", "/extract/backend/package-lock.json", "/app/" ] + # hadolint ignore=DL3008,DL3015,SC2086,SC2155,DL3003,DL3016 RUN \ apt-get -qq update \ && \ apt-get -qq install -y \ nodejs \ - youtube-dl \ + npm \ ffmpeg \ - unzip \ python \ ffmpeg \ atomicparsley \ + && echo "==Installing youtubedl-material==" \ + && npm install \ + && printf "UpdateMethod=docker\nPackageVersion=%s\nPackageAuthor=[TrueCharts Project](https://truecharts.org)" "${VERSION}" > /app/package_info \ && echo "==Running Cleanup ==" \ + && apt-get remove -y \ + npm \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ && apt-get autoremove -y \ && apt-get clean \ @@ -72,9 +88,9 @@ RUN \ && printf "umask %d" "${UMASK}" >> /etc/bash.bashrc \ && update-ca-certificates -COPY --from=builder --chown=apps:apps /app /app +COPY --chown=apps:apps --from=builder [ "/extract/build/backend/public/", "/app/public/" ] +COPY --chown=apps:apps --from=builder [ "/extract/backend/", "/app/" ] -WORKDIR /app USER apps VOLUME /data/appdata