diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..2511803 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,39 @@ +name: Push Docker Image to ghcr.io + +# Run when release is published +on: + release: + types: [published] + workflow_dispatch: # Allow for manual push so I can test it + +jobs: + build: + runs-on: ubuntu-latest + + # Minimum required permissions + permissions: + contents: read + packages: write + + steps: + # Checkout code + - name: Checkout code + uses: actions/checkout@v3 + + # Login to ghcr (automatically uses workflow actor and secret) + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Pushes to both :latest and : + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/tiddl:${{ github.event.release.tag_name }} + ghcr.io/${{ github.repository_owner }}/tiddl:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b9e19f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:alpine +WORKDIR /root +COPY . . +RUN --mount=type=cache,target=/root/.cache/pip pip install . +RUN rm -rf * +RUN apk add ffmpeg diff --git a/README.md b/README.md index 1a0aa45..c57cb9d 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,31 @@ Commands: search Search on Tidal. url Get Tidal URL. ``` +## Dockerised Version (no Python required) + +Based on python:alpine, slim build +**Docker run example (quickest / easiest)** +``` +docker run -rm -v /downloads/dir:/root/Music/Tiddl/ -v ./config/tiddl/:/root/ > +``` + +**docker-compose.yml example (not required, though allows for advanced configs)** +``` +services: + tiddl: + container_name: tiddl + image: :latest + volumes: + - /downloads/dir:/root/Music/Tiddl/ #default dir + - ./config/tiddl/:/root/ # Default location of config file + command: tail -f /dev/null # Keep it running in background +``` +**Access the container:** +``` +docker exec -it tiddl sh +``` + +_all other instructions match python version_ # Basic usage