Skip to content

Conversation

@beeltec
Copy link

@beeltec beeltec commented Jan 16, 2026

Add Docker Support with All External Binaries

Summary

This PR adds Docker support for gamdl, providing a containerized environment with all required and optional external binaries pre-installed. Users can run gamdl without needing to manually install FFmpeg, mp4decrypt, MP4Box, or N_m3u8DL-RE on their system.

Changes

New Files

  • Dockerfile: Multi-stage build that creates an optimized image with all dependencies
  • .dockerignore: Excludes unnecessary files from the Docker build context

Modified Files

  • README.md: Added Docker usage documentation with examples

Technical Details

Dockerfile Architecture

The Dockerfile uses a 4-stage multi-stage build for optimal image size:

Stage Purpose Base Image
builder Install gamdl from PyPI python:3.11-slim
bento4-builder Compile mp4decrypt from source python:3.11-slim
gpac-builder Compile MP4Box from source python:3.11-slim
Final Runtime image python:3.11-slim

Included Binaries

Binary Source Purpose
FFmpeg Debian packages Remuxing, format conversion
mp4decrypt Built from Bento4 Widevine DRM decryption
MP4Box Built from GPAC Alternative remuxing
N_m3u8DL-RE Latest release from GitHub Fast HLS downloading

Security Considerations

  • Uses --no-install-recommends to minimize attack surface
  • Cleans up apt lists after installation
  • Uses python:3.11-slim base for smaller footprint
  • .dockerignore prevents sensitive files (cookies, .env) from being copied into the build context

Usage Examples

Basic usage:

docker build -t gamdl .
docker run --rm \
  -v /path/to/cookies.txt:/app/cookies.txt:ro \
  -v /path/to/output:/app/music \
  gamdl --cookies-path /app/cookies.txt --output-path /app/music "https://music.apple.com/..."

With N_m3u8DL-RE downloader:

docker run --rm \
  -v ./cookies.txt:/app/cookies.txt:ro \
  -v ./music:/app/music \
  gamdl --cookies-path /app/cookies.txt --output-path /app/music --download-mode nm3u8dlre "https://music.apple.com/..."

With config persistence:

docker run --rm \
  -v /path/to/cookies.txt:/app/cookies.txt:ro \
  -v /path/to/output:/app/music \
  -v /path/to/config:/root/.gamdl \
  gamdl --cookies-path /app/cookies.txt --output-path /app/music "https://music.apple.com/..."

Test Results

  • Build Docker image on amd64: docker build -t gamdl .
  • Build Docker image on arm64: docker build -t gamdl .
  • Verify all binaries are present: docker run --rm gamdl --help
  • Test basic song download with ffmpeg remuxing
  • Test download with --download-mode nm3u8dlre
  • Test download with --remux-mode mp4box
  • Verify mp4decrypt works for DRM content
  • Test config persistence across container restarts

Add Dockerfile with multi-stage build that includes all required and
optional external binaries (FFmpeg, mp4decrypt, MP4Box, N_m3u8DL-RE).
Update README with Docker usage examples and volume mount configuration.

The Docker image allows running gamdl without manually installing
external dependencies, making it easier to use on any platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant