-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile for image build and update README
Add working dockerfile and update readme enable docker image build
- Loading branch information
Showing
6 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
RewriteEngine on | ||
RewriteRule rss dir2cast.php | ||
|
||
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" | ||
RewriteRule .* - [L,R=404] | ||
|
||
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.ini[? ].*$" | ||
RewriteRule .* - [L,R=404] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM php:8.1-apache | ||
|
||
|
||
# prep folders and perms | ||
RUN mkdir -p /var/www/html/episodes | ||
|
||
# set up new dir2cast.ini | ||
# write the config | ||
ENV MP3_DIR=/var/www/html/episodes \ | ||
MP3_URL=http://var/www/html/episodes \ | ||
RECURSIVE_DIRECTORY_ITERATOR=true \ | ||
COPYRIGHT= \ | ||
WEBMASTER= \ | ||
ITUNES_OWNER_NAME= \ | ||
ITUNES_OWNER_EMAIL= \ | ||
LINK= \ | ||
TITLE= \ | ||
ITUNES_AUTHOR= \ | ||
ITUNES_CATEGORIES= \ | ||
ITUNES_EXPLICIT=false \ | ||
DESCRIPTION= \ | ||
ITUNES_SUBTITLE= \ | ||
ITUNES_SUMMARY= \ | ||
ITUNES_SUBTITLE_SUFFIX= \ | ||
ITUNES_TYPE= \ | ||
LANGUAGE="en-us" \ | ||
ITEM_COUNT=10000 \ | ||
TITLE= \ | ||
AUTO_SAVE_COVER_ART=false \ | ||
MIN_FILE_AGE=30 \ | ||
MIN_CACHE_TIME=5 \ | ||
TTL=60 \ | ||
FORCE_PASSWORD= \ | ||
# OUTPUT_FILE= \ | ||
ATOM_TYPE= \ | ||
DESCRIPTION_SOURCE= \ | ||
DESCRIPTION_HMTL= | ||
|
||
# copy source files to docker | ||
COPY ./.htaccess/ /var/www/html/ | ||
COPY ./dir2cast.php /var/www/html/ | ||
COPY ./getID3/ /var/www/html/getID3/ | ||
COPY entrypoint.sh /usr/local/bin/ | ||
RUN a2enmod rewrite | ||
ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"] | ||
EXPOSE 80 | ||
CMD ["apache2-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ Features: | |
* You can set a per-file iTunes Summary by creating a text file with the same | ||
name as the media file (e.g. for file.mp3, create file.txt). | ||
|
||
* You can deploy a container using the ctkcoding/dir2cast Docker image | ||
|
||
|
||
QUICK HOW TO GUIDES | ||
================================================================================ | ||
|
@@ -98,6 +100,45 @@ podcast that it generates uses the tags from your files. | |
the "`temp`" folder that is created. | ||
|
||
|
||
DOCKER SETUP | ||
================================================================================ | ||
Note: There are many ways to get dir2cast working under docker, and this guide | ||
is a product of trial and error. There are settings in dir2cast and SWAG that are | ||
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 ENV definitions for options in dir2cast.ini that are supported, a few have been pruned for this image | ||
5. Once you add media files to the podcast_volume (or local folder), your podcast | ||
feed should now exist at `<docker server ip>:<container port>/rss` and requests to any .php or .ini file will be returned as 404 | ||
|
||
Remote using SWAG | ||
----------------- | ||
1. Install SWAG and test that you can remotely access your docker server. Here's | ||
a guide https://docs.linuxserver.io/general/swag | ||
2. Create a `<name>.subdomain.conf` file for your podcast server container as | ||
specified in the SWAG guide | ||
3. Add your dir2cast container to the network that you created with SWAG and only that network | ||
4. Check that podcasts 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) | ||
|
||
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. | ||
* 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 | ||
|
||
Thank you to @ctkcoding for the contribution of this guide. | ||
|
||
UNDERSTANDING HOW THE CACHING WORKS | ||
================================================================================ | ||
|
||
|
@@ -218,7 +259,7 @@ To run the unit tests: | |
COPYRIGHT & LICENSE | ||
================================================================================ | ||
|
||
Copyright (c) 2008-2021, Ben XO ([email protected]). | ||
Copyright (c) 2008-2023, Ben XO (@benxo on most platforms). | ||
|
||
The software is released under the BSD License. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/****************************************************************************** | ||
* Copyright (c) 2008-2022, Ben XO ([email protected]). | ||
* Copyright (c) 2008-2023, Ben XO (@benxo on most platforms). | ||
* | ||
* All rights reserved. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# set -eo pipefail | ||
|
||
echo "in entrypoint" | ||
|
||
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 | ||
echo COPYRIGHT = $COPYRIGHT \ >> /var/www/html/dir2cast.ini | ||
echo WEBMASTER = $WEBMASTER \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_OWNER_NAME = $ITUNES_OWNER_NAME \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_OWNER_EMAIL = $ITUNES_OWNER_EMAIL \ >> /var/www/html/dir2cast.ini | ||
echo LINK = $LINK \ >> /var/www/html/dir2cast.ini | ||
echo TITLE = $TITLE \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_AUTHOR = $ITUNES_AUTHOR \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_CATEGORIES = $ITUNES_CATEGORIES \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_EXPLICIT = $ITUNES_EXPLICIT \ >> /var/www/html/dir2cast.ini | ||
echo DESCRIPTION = $DESCRIPTION \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_SUBTITLE = $ITUNES_SUBTITLE \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_SUMMARY = $ITUNES_SUMMARY \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_SUBTITLE_SUFFIX = $ITUNES_SUBTITLE_SUFFIX \ >> /var/www/html/dir2cast.ini | ||
echo ITUNES_TYPE = $ITUNES_TYPE \ >> /var/www/html/dir2cast.ini | ||
echo LANGUAGE = $LANGUAGE \ >> /var/www/html/dir2cast.ini | ||
echo ITEM_COUNT= $ITEM_COUNT \ >> /var/www/html/dir2cast.ini | ||
echo TITLE = $TITLE \ >> /var/www/html/dir2cast.ini | ||
echo AUTO_SAVE_COVER_ART = $AUTO_SAVE_COVER_ART \ >> /var/www/html/dir2cast.ini | ||
echo MIN_FILE_AGE = $MIN_FILE_AGE \ >> /var/www/html/dir2cast.ini | ||
echo MIN_CACHE_TIME = $MIN_CACHE_TIME \ >> /var/www/html/dir2cast.ini | ||
echo TTL = $TTL \ >> /var/www/html/dir2cast.ini | ||
echo FORCE_PASSWORD = $FORCE_PASSWORD \ >> /var/www/html/dir2cast.ini | ||
# OUTPUT_FILE= \ | ||
echo ATOM_TYPE = $ATOM_TYPE \ >> /var/www/html/dir2cast.ini | ||
echo DESCRIPTION_SOURCE = $DESCRIPTION_SOURCE \ >> /var/www/html/dir2cast.ini | ||
echo DESCRIPTION_HMTL = $DESCRIPTION_HMTL \ >> /var/www/html/dir2cast.ini | ||
|
||
echo "ini file written" | ||
exec "$@" | ||
|
||
# RUN if [[ $IMAGE ]]; then echo "IMAGE = ${IMAGE}" >> /var/www/html/dir2cast.ini; fi; | ||
# RUN if [[ $ITUNES_EXPLICIT ]]; then echo "ITUNES_EXPLICIT = ${ITUNES_EXPLICIT}" >> /var/www/html/dir2cast.ini; fi; | ||
# RUN if [[ $DESCRIPTION ]]; then echo "DESCRIPTION = ${DESCRIPTION}" >> /var/www/html/dir2cast.ini; fi; | ||
# RUN if [[ $ITUNES_AUTHOR ]]; then echo "ITUNES_AUTHOR = ${ITUNES_AUTHOR}" >> /var/www/html/dir2cast.ini; fi; | ||
# RUN if [[ $RECURSIVE_DIRECTORY_ITERATOR ]]; then echo "RECURSIVE_DIRECTORY_ITERATOR = ${RECURSIVE_DIRECTORY_ITERATOR}" >> /var/www/html/dir2cast.ini; fi; | ||
# RUN if [[ $AUTO_SAVE_COVER_ART ]]; then echo "AUTO_SAVE_COVER_ART = ${AUTO_SAVE_COVER_ART}" >> /var/www/html/dir2cast.ini; fi; |