diff --git a/Dockerfile b/Dockerfile index 5e96cd1..7cabe94 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,11 @@ COPY requirements.txt requirements.txt # Install Python requirements RUN pip3 install --no-cache-dir -r requirements.txt +# Make Docker /config volume for optional config file +VOLUME /config + # Copy config file from build machine to Docker /config folder -COPY config.yaml* / +COPY config.yaml* /config/ # Make Docker /logs volume for log file VOLUME /logs diff --git a/README.md b/README.md index dc2a493..babb350 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,10 @@ docker run -d \ #### Paths and Environment Variables -| Path | Description | -|---------|-------------------------------------------------------------------| -| `/` | Path to config files (`config.yaml` should be in this directory) | -| `/logs` | Path to log files (`Plex Prerolls.log` will be in this directory) | +| Path | Description | +|-----------|-----------------------------------------------------------------------| +| `/config` | Path to config directory (`config.yaml` should be in this directory) | +| `/logs` | Path to log directory (`Plex Prerolls.log` will be in this directory) | | Environment Variable | Description | |----------------------|-------------------------------------------------------------------| @@ -140,28 +140,28 @@ date_range: # Each entry requires start_date, end_date, path values - start_date: 2020-01-01 # Jan 1st, 2020 end_date: 2020-01-02 # Jan 2nd, 2020 - paths: - - /path/to/video.mp4 - - /path/to/another/video.mp4 + paths: + - /path/to/video.mp4 + - /path/to/another/video.mp4 weight: 2 # Add these paths to the list twice (make up greater percentage of prerolls - more likely to be selected) - start_date: xxxx-07-04 # Every year on July 4th end_date: xxxx-07-04 # Every year on July 4th paths: - - /path/to/video.mp4 - - /path/to/another/video.mp4 + - /path/to/video.mp4 + - /path/to/another/video.mp4 weight: 1 - name: "My Schedule" # Optional name for logging purposes start_date: xxxx-xx-02 # Every year on the 2nd of every month end_date: xxxx-xx-03 # Every year on the 3rd of every month paths: - - /path/to/video.mp4 - - /path/to/another/video.mp4 + - /path/to/video.mp4 + - /path/to/another/video.mp4 weight: 1 - start_date: xxxx-xx-xx 08:00:00 # Every day at 8am end_date: xxxx-xx-xx 09:30:00 # Every day at 9:30am paths: - - /path/to/video.mp4 - - /path/to/another/video.mp4 + - /path/to/video.mp4 + - /path/to/another/video.mp4 weight: 1 ``` diff --git a/entrypoint.sh b/entrypoint.sh index 968b57e..4892818 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,7 +21,7 @@ echo "Dry run flag: $DRY_RUN_FLAG" # Schedule cron job with supplied cron schedule echo "Scheduling cron job" -echo "$CRON_SCHEDULE python3 /run.py -c /config.yaml -l /logs $DRY_RUN_FLAG > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/cron.d/schedule_preroll +echo "$CRON_SCHEDULE python3 /run.py -c /config/config.yaml -l /logs $DRY_RUN_FLAG > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/cron.d/schedule_preroll # Give execution rights on the cron job chmod 0644 /etc/cron.d/schedule_preroll