Skip to content

Commit

Permalink
build: [dl-downer] playwright install as user
Browse files Browse the repository at this point in the history
  • Loading branch information
BelgianNoise committed May 27, 2024
1 parent 8649700 commit c16154f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
47 changes: 39 additions & 8 deletions dl-downer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -26,25 +26,56 @@ 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
RUN apt-get install -y ffmpeg mkvtoolnix

# Install python packages + playwright install
RUN pip install --no-cache-dir -r requirements.txt
# RUN pip install [email protected]
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" ]
7 changes: 4 additions & 3 deletions dl-downer/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
gosu $PUID:$PGID playwright install
# Run the specified command as the new user
exec gosu $PUID:$PGID "$@"

0 comments on commit c16154f

Please sign in to comment.