ytdl-sub/docker/Dockerfile
Ross Patterson 2cc24e85f1
fix(docker): Default config available in WORKDIR
When running arbitrary commands in the container, the default configuration and
subscription file paths don't work. I've tested using `$ docker compose up
--workdir="/config" ...` and the s6-overlay base image bits seem to work just fine, the
output from running cron jobs appears. Then running `$ ytdl-sub sub` without options
"Just Works", so I think baking a `WORKDIR` into the image should be OK, but this should
be tested further before breaking everybody's deployments.

I tested locally by bringing up the compose services and confirming from the output that
the s6-overlay init and cron seem to be working correctly. Then I ran `$ ytdl-sub sub
--dry-run` using both `$ docker compose run ...` and `$ docker compose exec ...`. Before
this change, it exits immediately with a message about the subscriptions file
missing. After this change, it starts to download the `NOVA PBS` subscription. In the
GUI image, I also tested the same command in the VS Code web UI terminal.
2025-08-27 09:52:43 -07:00

71 lines
2.3 KiB
Docker

FROM ghcr.io/linuxserver/baseimage-alpine:edge
###############################################################################
# YTDL-SUB INSTALL
# For phantomjs
ENV OPENSSL_CONF="/etc/ssl"
# For downloading thumbnails
ENV SSL_CERT_DIR="/etc/ssl/certs/"
# Working directory used at both build and run times:
ENV DEFAULT_WORKSPACE="/config"
COPY root/ /
RUN mkdir -pv "${DEFAULT_WORKSPACE}" && \
apk update --no-cache && \
apk upgrade --no-cache && \
apk add --no-cache --repository=http://dl-3.alpinelinux.org/alpine/edge/main/ \
vim \
g++ \
nano \
make \
libffi-dev \
"python3>=3.10" \
py3-pip \
fontconfig \
py3-setuptools && \
# Install edge ffmpeg and aria2 from community, ensure they are properly installed
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
"ffmpeg>5.1" \
"aria2>=1.36.0" && \
ffmpeg -version && \
aria2c --version && \
# Install phantomjs if using x86_64, ensure it is properly installed
if [[ $(uname -m) == "x86_64" ]]; then \
echo "installing phantomjs" && \
apk add --no-cache gcompat && \
tar -xjvf /defaults/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/share/phantomjs && \
rm -rf phantomjs-2.1.1-linux-x86_64 && \
rm /defaults/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
ln -s /usr/share/phantomjs /usr/bin/phantomjs && \
echo "Phantom JS version:" && \
phantomjs --version && \
cd -; \
fi && \
echo "hi" && \
# Install ytdl-sub, ensure it is installed properly
python3 -m pip install --break-system-packages --no-cache-dir ytdl_sub-*.whl && \
ytdl-sub -h && \
# Delete unneeded packages after install
rm ytdl_sub-*.whl && \
apk del \
g++ \
make \
libffi-dev \
py3-pip \
py3-setuptools
###############################################################################
# CONTAINER CONFIGS
ENV EDITOR="nano" \
HOME="${DEFAULT_WORKSPACE}" \
DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \
CRON_SCRIPT="${DEFAULT_WORKSPACE}/cron" \
CRON_WRAPPER_SCRIPT="${DEFAULT_WORKSPACE}/.cron_wrapper" \
LOGS_TO_STDOUT="${DEFAULT_WORKSPACE}/.cron.log" \
LSIO_FIRST_PARTY=false
VOLUME "${DEFAULT_WORKSPACE}"
WORKDIR "${DEFAULT_WORKSPACE}"