diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..78acf72 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +# Official python 3.12 container image +FROM python:3.12-slim-bookworm + + +# Environment variables + +# Name of the user that will be created +ENV USER_NAME="appuser" + +# Name of the group in which the user will be added +ENV GROUP_NAME="users" + +# Created user's ID +ENV UID="1000" + +# User's home path +ENV HOME_PATH="/home/appuser" + +# User's music directory +ENV MUSIC_PATH="${HOME_PATH}/music" + + + +# Set the working directory in the container to /app +WORKDIR /app + +# Updating repos +RUN apt update + +# Installing ffmpeg for tidal-dl-ng from apt +RUN apt install -y ffmpeg + +# Installing tidal-dl-ng from pip +RUN pip install --upgrade tidal-dl-ng + +# Creating a user named USER_NAME belonging to group GROUP_NAME along with its home directory +RUN useradd -m -u ${UID} -g ${GROUP_NAME} ${USER_NAME} + +# As USER_NAME : +USER ${USER_NAME} + +# Creating music folder +RUN mkdir -p ${MUSIC_PATH} + +# Configuring ffmpeg and download path for tidal-dl-ng +RUN tidal-dl-ng cfg path_binary_ffmpeg $(which ffmpeg) +RUN tidal-dl-ng cfg download_base_path ${MUSIC_PATH} + +# Working directory is appuser's home +WORKDIR ${HOME_PATH} + +# Default command if none provided is bash shell +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 12abd78..3ae211f 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,9 @@ If you like this projects and want to support it, feel free to buy me a coffee ## 💻 Installation / Upgrade + +### 🐍 Installing with pip + **Requirements**: Python == 3.12 (other versions might work but are not tested!) ```bash @@ -50,8 +53,19 @@ pip install --upgrade tidal-dl-ng pip install --upgrade tidal-dl-ng[gui] ``` +### 🐋 Building the Docker image +**Requirements**: Docker == 27.5.0 (other verions might work but are not tested!) +All you need is the ```Dockerfile``` file from this repository and be in the same directory as it. +To build the image using ```docker build``` command: +```bash +docker build -t . +``` +You can give any name you want to the container. The Dockerfile should be easily modified to fit your needs but works great as is. + + ## ⌨️ Usage +### 🐍 Using pip You can use the command line (CLI) version to download media by URL: ```bash @@ -82,6 +96,23 @@ tidal-dl-ng gui If you like to have the GUI version only as a binary, have a look at the [release page](https://github.com/exislow/tidal-dl-ng/releases) and download the correct version for your platform. +### 🐋 Using the Docker image + +Simply create a music and config folders to mount to the container you will create, then run : + +```bash + +docker run -v "/path/to/host/music/folder/:/home/appuser/music" -v "/path/to/host/config/dir/:/home/appuser/.config/tidal_dl_ng/" -it :latest tdn + +``` + +This command will also create two files to store your ```settings.json``` as well as your ```token.json``` when connected to Tidal. + +⚠️ The folder from the host that you map in the container must exist beforehand since if Docker creates it, it might be owned by ```root``` and tidal-dl-ng **will not have the rights** to write in this folder ⚠️ + +💡 You can also run a bash shell if you want to tinker in the container. Nano and ffmpeg are installed and the ffmpeg path is preconfigured in the ```settings.json```. +Currently, the Docker image does not support the GUI version. + ## 🧁 Features - Download tracks, videos, albums, playlists, your favorites etc.