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.
This commit is contained in:
Ross Patterson 2025-08-15 23:25:47 -07:00
parent e8bb3cad14
commit 2cc24e85f1
No known key found for this signature in database
GPG key ID: 2EFF7CCE6828E359
3 changed files with 21 additions and 16 deletions

View file

@ -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
VOLUME "${DEFAULT_WORKSPACE}"
WORKDIR "${DEFAULT_WORKSPACE}"

View file

@ -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
VOLUME /config
WORKDIR "${DEFAULT_WORKSPACE}"

View file

@ -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
VOLUME "${DEFAULT_WORKSPACE}"
WORKDIR "${DEFAULT_WORKSPACE}"