Skip to content

Commit

Permalink
update and clarify docker usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ctkcoding committed Feb 3, 2025
1 parent 10c36ba commit 557771e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN mkdir -p /var/www/html/episodes
# initialize env vars with defaults
# these can be changed with -e at docker run
ENV MP3_DIR=/var/www/html/episodes \
MP3_URL=http://var/www/html/episodes \
MP3_URL= \
RECURSIVE_DIRECTORY_ITERATOR=true \
COPYRIGHT= \
WEBMASTER= \
Expand Down
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,10 @@ not covered in this guide.

Local setup
-----------
1. Map the container's port 80 to whatever port you want to access it with on your
local network (e.g. port 8080)
2. Episodes will be scanned for at `/var/www/html/episodes` unless you pass in a
different MP3_DIR, so make sure to create a volume to map under `/var/www/html`,
or directly bind the episodes folder to a location on your file system where you wish to store episodes
4. To start the container, try something like:
`docker run --name dir2cast -d -p 8080:80 -v podcast_volume:/var/www/html/episodes ctkcoding/dir2cast:latest` and add env vars to represent settings in dir2cast.ini that
you'd like to change from the default. Dockerfile contains a list of supported ENV
options and defaults that will be used to create a new dir2cast.ini at container run
time
5. Once you add media files to the location you chose after step 2, your podcast
feed should now exist at `<docker server ip>:<container port>/rss`
1. Review the existing docker-compose file as a baseline to start locally.
2. Episodes are expected at `/var/www/html/episodes` unless you pass in a different MP3_DIR, so make sure to create a volume to map under `/var/www/html`, or directly bind the episodes folder to a location on your file system where you wish to store episodes.
3. For any other changes - review the compose file and set ENV vars as you'd like. Dockerfile contains a list of supported options and defaults that will be used to create a new dir2cast.ini at container startup.
4. Once you add media files to the location you chose after step 2, your podcast feed should now exist at `<docker ip>:<port>/rss`

Remote using SWAG
-----------------
Expand All @@ -132,17 +124,17 @@ Remote using SWAG
restart both containers
4. Check that podcast episodes can be played/downloaded. If your feed exists and can be
subscribed to, but files aren't available, try setting `MP3_URL` env var with
https:// rather than http://. (see comment in ini file)
https:// (see comment in source ini file)

Notes
-----
* If you have shared folders that are accessible from your computer, using a bind mount
(rather than a docker volume) is an easy way to enable a simple workflow for you to
drag and drop content into the podcast feed.
* If you see '.\_' prefixed junk files in your feed, that is an unfortunate side-effect
of using network shares from macOS, and not dir2cast's fault.
of using network shares from macOS, and not dir2cast's fault. Use the macOS native dot_clean command to remove these
* 502 errors are likely SWAG configuration problems. Check container name, port mapping, etc.
* currently the only docker env vars that can be fed in at startup and set in dir2cast.ini are ITEM_COUNT, MP3_DIR, TITLE, AUTO_SAVE_COVER_ART. Copy the RUN commands in Dockerfile for any new env vars needed
* all dir2cast.ini variables should be supported as docker env vars - if you find this is not correct, look at the RUN commands in Dockerfile for any new env vars needed

Thank you to @ctkcoding for the contribution of this guide.

Expand Down
41 changes: 14 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
version: "2.3"

# after "docker-compose up" try the following URLs as examples:
# http://localhost:8080/
# http://localhost:8080/test/fixtures/

volumes:
config:

services:
web:
image: nginx:alpine
ports:
- "8080:80"
volumes:
- .:/var/www/html
- ./docker-compose/nginx/default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm

php-fpm:
image: php:7-fpm-alpine
volumes:
- .:/var/www/html

# You could also create a Dockerfile FROM php:7-fpm-alpine which includes these next two
- ./dir2cast.php:/dir2cast.php
- ./getID3:/getID3

# You should map a temp folder in otherwise you'll see errors about permission denied mkdir()
- /tmp:/temp
podcast:
image: ghcr.io/ctkcoding/dir2cast:main
container_name: podcast
restart: unless-stopped
ports:
- "2022:80"
volumes:
- episode_location:/var/www/html/episodes
- config:/var/www/html
# environment:
# - MP3_URL = https://domain.com/episodes/
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

file="/var/www/html/dir2cast.ini"

if [ -f "$file" ] ; then
rm "$file"
fi

echo MP3_DIR = $MP3_DIR \ >> /var/www/html/dir2cast.ini
echo MP3_URL= $MP3_URL \ >> /var/www/html/dir2cast.ini
echo RECURSIVE_DIRECTORY_ITERATOR = $RECURSIVE_DIRECTORY_ITERATOR \ >> /var/www/html/dir2cast.ini
Expand Down

0 comments on commit 557771e

Please sign in to comment.