Merge pull request #97 from tikhonp/main

Fix song not fully transcoding due to old mp4box image, add GitHub CI build to create docker images
This commit is contained in:
ZHAAREY
2025-12-20 20:14:33 +08:00
committed by GitHub
3 changed files with 69 additions and 20 deletions

43
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

View File

@@ -8,7 +8,15 @@ RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /bin/apple-music-dl main.go
FROM sambaiz/mp4box
FROM gpac/ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /bin/apple-music-dl /usr/local/bin/apple-music-dl
WORKDIR /app
COPY config.yaml ./
RUN echo 'alac-save-folder: "/downloads/ALAC"' >> config.yaml \
&& echo 'atmos-save-folder: "/downloads/Atmos"' >> config.yaml \
&& echo 'aac-save-folder: "/downloads/AAC"' >> config.yaml
ENTRYPOINT ["/usr/local/bin/apple-music-dl"]

View File

@@ -30,43 +30,41 @@ Original script by Sorrow. Modified by me to include some fixes and improvements
## Running with Docker
1. Make sure the decryption program [wrapper](https://github.com/WorldObservationLog/wrapper) is running
2. Modify config.yaml to add this lines to set download path:
```yaml
alac-save-folder: "/downloads/ALAC"
atmos-save-folder: "/downloads/ATMOS"
aac-save-folder: "/downloads/AAC"
```
2. Build the Docker image:
```bash
docker build -t apple-music-dl .
```
3. Run downloader:
2. Start the downloader with Docker:
```bash
# show help
docker run --network host -v ../downloads:/downloads apple-music-dl --help
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --help
# start downloading some albums
docker run --network host -v ../downloads:/downloads apple-music-dl https://music.apple.com/ru/album/children-of-forever/1443732441
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader https://music.apple.com/ru/album/children-of-forever/1443732441
# start downloading single song
docker run --network host -v ../downloads:/downloads apple-music-dl --song https://music.apple.com/ru/album/bass-folk-song/1443732441?i=1443732453
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --song https://music.apple.com/ru/album/bass-folk-song/1443732441?i=1443732453
# start downloading select
docker run -it --network host -v ../downloads:/downloads apple-music-dl --select https://music.apple.com/ru/album/children-of-forever/1443732441
docker run -it --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --select https://music.apple.com/ru/album/children-of-forever/1443732441
# start downloading some playlists
docker run --network host -v ../downloads:/downloads apple-music-dl https://music.apple.com/us/playlist/taylor-swift-essentials/pl.3950454ced8c45a3b0cc693c2a7db97b
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader https://music.apple.com/us/playlist/taylor-swift-essentials/pl.3950454ced8c45a3b0cc693c2a7db97b
# for dolby atmos
docker run --network host -v ../downloads:/downloads apple-music-dl --atmos https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --atmos https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538
# for aac
docker run --network host -v ../downloads:/downloads apple-music-dl --aac https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --aac https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538
# for see quality
docker run --network host -v ./downloads:/downloads apple-music-dl --debug https://music.apple.com/ru/album/miles-smiles/209407331
docker run --network host -v ./downloads:/downloads ghcr.io/zhaarey/apple-music-downloader --debug https://music.apple.com/ru/album/miles-smiles/209407331
```
You can change `config.yaml` by mounting a volume:
> **Note:** Before running the following command, make sure that a `config.yaml` file exists in your current directory. You can create your own, or copy the default one from the repository (if available). If `./config.yaml` does not exist, Docker will create an empty directory instead of a file, which will cause the container to fail.
```bash
docker run --network host -v ./downloads:/downloads -v ./config.yaml:/app/config.yaml ghcr.io/zhaarey/apple-music-downloader [args]
```
## How to use
1. Make sure the decryption program [wrapper](https://github.com/WorldObservationLog/wrapper) is running
2. Start downloading some albums: `go run main.go https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511`.