From 2cc24e85f1d93e5def19942d8f886ce11fbb4215 Mon Sep 17 00:00:00 2001 From: Ross Patterson Date: Fri, 15 Aug 2025 23:25:47 -0700 Subject: [PATCH] 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. --- docker/Dockerfile | 16 +++++++++------- docker/Dockerfile.gui | 5 +++-- docker/Dockerfile.ubuntu | 16 +++++++++------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a5b68b59..f50d68dc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,9 +7,11 @@ FROM ghcr.io/linuxserver/baseimage-alpine:edge 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 -p /config && \ +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/ \ @@ -58,12 +60,12 @@ RUN mkdir -p /config && \ # CONTAINER CONFIGS ENV EDITOR="nano" \ -HOME="/config" \ +HOME="${DEFAULT_WORKSPACE}" \ DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \ -DEFAULT_WORKSPACE=/config \ -CRON_SCRIPT="/config/cron" \ -CRON_WRAPPER_SCRIPT="/config/.cron_wrapper" \ -LOGS_TO_STDOUT=/config/.cron.log \ +CRON_SCRIPT="${DEFAULT_WORKSPACE}/cron" \ +CRON_WRAPPER_SCRIPT="${DEFAULT_WORKSPACE}/.cron_wrapper" \ +LOGS_TO_STDOUT="${DEFAULT_WORKSPACE}/.cron.log" \ LSIO_FIRST_PARTY=false -VOLUME /config \ No newline at end of file +VOLUME "${DEFAULT_WORKSPACE}" +WORKDIR "${DEFAULT_WORKSPACE}" diff --git a/docker/Dockerfile.gui b/docker/Dockerfile.gui index dd04e318..6e2f8309 100644 --- a/docker/Dockerfile.gui +++ b/docker/Dockerfile.gui @@ -81,9 +81,10 @@ ENV EDITOR="nano" \ HOME="/config" \ DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \ DEFAULT_WORKSPACE=/config/ytdl-sub-configs \ -CRON_SCRIPT="/config/ytdl-sub-configs/cron" \ +CRON_SCRIPT="${DEFAULT_WORKSPACE}/cron" \ CRON_WRAPPER_SCRIPT="/config/.cron_wrapper" \ LOGS_TO_STDOUT=/config/.cron.log \ LSIO_FIRST_PARTY=false -VOLUME /config \ No newline at end of file +VOLUME /config +WORKDIR "${DEFAULT_WORKSPACE}" diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index de7dce0f..37240dd4 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -7,13 +7,15 @@ ARG DEBIAN_FRONTEND=noninteractive 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" ############################################################################### # YTDL-SUB INSTALL SHELL ["/bin/bash", "-c"] COPY root/ / -RUN mkdir -p /config && \ +RUN mkdir -pv "${DEFAULT_WORKSPACE}" && \ apt-get -y update && \ apt-get -y upgrade && \ apt-get install --no-install-recommends -y \ @@ -81,12 +83,12 @@ RUN mkdir -p /config && \ # CONTAINER CONFIGS ENV EDITOR="nano" \ -HOME="/config" \ +HOME="${DEFAULT_WORKSPACE}" \ DOCKER_MODS=linuxserver/mods:universal-stdout-logs|linuxserver/mods:universal-cron \ -DEFAULT_WORKSPACE=/config \ -CRON_SCRIPT="/config/cron" \ -CRON_WRAPPER_SCRIPT="/config/.cron_wrapper" \ -LOGS_TO_STDOUT=/config/.cron.log \ +CRON_SCRIPT="${DEFAULT_WORKSPACE}/cron" \ +CRON_WRAPPER_SCRIPT="${DEFAULT_WORKSPACE}/.cron_wrapper" \ +LOGS_TO_STDOUT="${DEFAULT_WORKSPACE}/.cron.log" \ LSIO_FIRST_PARTY=false -VOLUME /config \ No newline at end of file +VOLUME "${DEFAULT_WORKSPACE}" +WORKDIR "${DEFAULT_WORKSPACE}"