YoutubeDL container efficiency upgrades (#381)

* try some youtubedl restructuring

* Some more restructure

* hadolint
This commit is contained in:
Kjeld Schouten-Lebbing
2021-04-18 13:31:35 +02:00
committed by GitHub
parent 9e5b290ef2
commit dca5326b4e
+34 -18
View File
@@ -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