From c16154f9aa1ff9f28cb2b8c07b2aeeb794ea2fc6 Mon Sep 17 00:00:00 2001 From: Arthur Joppart Date: Mon, 27 May 2024 12:58:49 +0200 Subject: [PATCH 1/2] build: [dl-downer] playwright install as user --- dl-downer/Dockerfile | 47 ++++++++++++++++++++++++++++++++++++-------- dl-downer/entry.sh | 7 ++++--- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/dl-downer/Dockerfile b/dl-downer/Dockerfile index 7544806..de7d489 100644 --- a/dl-downer/Dockerfile +++ b/dl-downer/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime as the base image -FROM python:3.12 +FROM python:3.12-slim LABEL org.opencontainers.image.source https://github.com/BelgianNoise/dl-utils @@ -26,15 +26,17 @@ ENV AUTH_GOPLAY_PASSWORD= ENV PUID=6969 ENV PGID=6969 -COPY . . +WORKDIR /app + +COPY . /app # Make all binaries executable -RUN chmod +x /binaries/linux/* +RUN chmod +x binaries/linux/* # Move binaries to /bin -RUN mv /binaries/linux/* /bin/ +RUN mv binaries/linux/* /bin/ # Move entry.sh to /bin -RUN chmod +x /entry.sh -RUN mv /entry.sh /bin/ +RUN chmod +x entry.sh +RUN mv entry.sh /bin/ # install ffmpeg and mkvmerge RUN apt-get update @@ -42,9 +44,38 @@ RUN apt-get install -y ffmpeg mkvtoolnix # Install python packages + playwright install RUN pip install --no-cache-dir -r requirements.txt -# RUN pip install playwright==@1.42.0 -RUN playwright install --with-deps +# install playwright dependencies +RUN apt-get install -y \ + libnss3 \ + libatk-bridge2.0-0 \ + libx11-xcb1 \ + libxcomposite1 \ + libxdamage1 \ + libxrandr2 \ + libxss1 \ + libxtst6 \ + libgbm1 \ + libasound2 \ + libgtk-3-0 +# RUN apt-get install -y \ +# libsoup2.4-1 \ +# gstreamer1.0-plugins-base \ +# libatomic1 \ +# libxslt1.1 \ +# libwoff1 \ +# libevent-2.1-6 \ +# libharfbuzz-icu0 \ +# gstreamer1.0-plugins-base \ +# gstreamer1.0-plugins-good \ +# libwebpdemux2 \ +# enchant \ +# libsecret-1-0 \ +# hyphen-en-us \ +# libgles2 RUN apt-get install -y sudo gosu +RUN rm -rf /var/lib/apt/lists/* ENTRYPOINT [ "entry.sh" ] + +CMD [ "python", "start.py" ] diff --git a/dl-downer/entry.sh b/dl-downer/entry.sh index 661a1e0..1615123 100644 --- a/dl-downer/entry.sh +++ b/dl-downer/entry.sh @@ -27,10 +27,11 @@ fi # Change ownership of the home directory chown -R "$PUID:$PGID" /home/myuser +chown -R "$PUID:$PGID" /app chown -R "$PUID:$PGID" /downloads chown -R "$PUID:$PGID" /storage_states -# Run the command as the specified user -set -- gosu "$PUID:$PGID" "$@" -exec python start.py "$@" \ No newline at end of file +gosu $PUID:$PGID playwright install +# Run the specified command as the new user +exec gosu $PUID:$PGID "$@" From 144d5e87efe0073f6b812ea5f9950ce0bf71b57f Mon Sep 17 00:00:00 2001 From: Arthur Joppart Date: Mon, 27 May 2024 13:33:33 +0200 Subject: [PATCH 2/2] Revert "build: [dl-downer] playwright install as user" This reverts commit c16154f9aa1ff9f28cb2b8c07b2aeeb794ea2fc6. --- dl-downer/Dockerfile | 47 ++++++++------------------------------------ dl-downer/entry.sh | 7 +++---- 2 files changed, 11 insertions(+), 43 deletions(-) diff --git a/dl-downer/Dockerfile b/dl-downer/Dockerfile index de7d489..7544806 100644 --- a/dl-downer/Dockerfile +++ b/dl-downer/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime as the base image -FROM python:3.12-slim +FROM python:3.12 LABEL org.opencontainers.image.source https://github.com/BelgianNoise/dl-utils @@ -26,17 +26,15 @@ ENV AUTH_GOPLAY_PASSWORD= ENV PUID=6969 ENV PGID=6969 -WORKDIR /app - -COPY . /app +COPY . . # Make all binaries executable -RUN chmod +x binaries/linux/* +RUN chmod +x /binaries/linux/* # Move binaries to /bin -RUN mv binaries/linux/* /bin/ +RUN mv /binaries/linux/* /bin/ # Move entry.sh to /bin -RUN chmod +x entry.sh -RUN mv entry.sh /bin/ +RUN chmod +x /entry.sh +RUN mv /entry.sh /bin/ # install ffmpeg and mkvmerge RUN apt-get update @@ -44,38 +42,9 @@ RUN apt-get install -y ffmpeg mkvtoolnix # Install python packages + playwright install RUN pip install --no-cache-dir -r requirements.txt -# install playwright dependencies -RUN apt-get install -y \ - libnss3 \ - libatk-bridge2.0-0 \ - libx11-xcb1 \ - libxcomposite1 \ - libxdamage1 \ - libxrandr2 \ - libxss1 \ - libxtst6 \ - libgbm1 \ - libasound2 \ - libgtk-3-0 -# RUN apt-get install -y \ -# libsoup2.4-1 \ -# gstreamer1.0-plugins-base \ -# libatomic1 \ -# libxslt1.1 \ -# libwoff1 \ -# libevent-2.1-6 \ -# libharfbuzz-icu0 \ -# gstreamer1.0-plugins-base \ -# gstreamer1.0-plugins-good \ -# libwebpdemux2 \ -# enchant \ -# libsecret-1-0 \ -# hyphen-en-us \ -# libgles2 +# RUN pip install playwright==@1.42.0 +RUN playwright install --with-deps RUN apt-get install -y sudo gosu -RUN rm -rf /var/lib/apt/lists/* ENTRYPOINT [ "entry.sh" ] - -CMD [ "python", "start.py" ] diff --git a/dl-downer/entry.sh b/dl-downer/entry.sh index 1615123..661a1e0 100644 --- a/dl-downer/entry.sh +++ b/dl-downer/entry.sh @@ -27,11 +27,10 @@ fi # Change ownership of the home directory chown -R "$PUID:$PGID" /home/myuser -chown -R "$PUID:$PGID" /app chown -R "$PUID:$PGID" /downloads chown -R "$PUID:$PGID" /storage_states -gosu $PUID:$PGID playwright install -# Run the specified command as the new user -exec gosu $PUID:$PGID "$@" +# Run the command as the specified user +set -- gosu "$PUID:$PGID" "$@" +exec python start.py "$@" \ No newline at end of file