Repository: wy580477/musicn-container
Branch: main
Commit: 32f296c0aa85
Files: 5
Total size: 7.4 KB
Directory structure:
gitextract_mw9i8qp2/
├── .github/
│ └── workflows/
│ └── container-build-publishing.yml
├── .last_upstream_tag
├── Dockerfile
├── LICENSE
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/container-build-publishing.yml
================================================
name: Check Tag & Build
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '0 * * * *' # 每小时检查一次
push:
branches:
- main # 选择你想要的分支
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
check-tag:
runs-on: ubuntu-latest
outputs:
trigger: ${{ steps.if_new_tag.outputs.new_tag }}
steps:
- name: Checkout This Repository
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Check Latest Tag from Upstream
id: check_tag
run: |
UPSTREAM_LATEST_TAG=$(npm show musicn version | head -n 1)
echo "Latest upstream tag: $UPSTREAM_LATEST_TAG"
echo "latest_tag=$UPSTREAM_LATEST_TAG" >> $GITHUB_ENV
- name: Check Last Processed Tag
id: check_last_tag
run: |
if [ -f .last_upstream_tag ]; then
LAST_PROCESSED_TAG=$(cat .last_upstream_tag)
echo "Last processed tag: $LAST_PROCESSED_TAG"
else
LAST_PROCESSED_TAG="none"
echo "No last processed tag found."
fi
echo "last_tag=$LAST_PROCESSED_TAG" >> $GITHUB_ENV
- name: Compare Tags
id: if_new_tag
if: ${{ env.latest_tag != env.last_tag }}
run: |
echo "New tag detected: ${latest_tag}"
echo "new_tag=true" >> "$GITHUB_OUTPUT"
- name: Save Last Processed Tag
if: ${{ env.latest_tag != env.last_tag }}
run: echo ${latest_tag} > .last_upstream_tag
- name: Commit and Push Last Processed Tag
if: ${{ env.latest_tag != env.last_tag }}
run: |
git add .last_upstream_tag
git commit -m "Update last processed upstream tag to ${latest_tag}"
git push
build:
needs: check-tag
runs-on: ubuntu-latest
if: needs.check-tag.outputs.trigger == 'true'
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Get Latest Tag from Upstream
id: get_tag
run: |
UPSTREAM_LATEST_TAG=$(npm show musicn version | head -n 1)
echo "Latest upstream tag: $UPSTREAM_LATEST_TAG"
echo "latest_tag=$UPSTREAM_LATEST_TAG" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
tags: |
type=raw,value=${{ env.latest_tag }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
================================================
FILE: .last_upstream_tag
================================================
1.5.3-beta.0
================================================
FILE: Dockerfile
================================================
FROM node:alpine
WORKDIR /data
RUN apk add --no-cache tini \
&& npm i musicn -g \
&& rm -rf ${HOME}/.npm
ENTRYPOINT ["/sbin/tini", "--"]
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 wy580477
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
## 鸣谢
- [zonemeen/musicn](https://github.com/zonemeen/musicn)
## 概述
可播放及下载音乐的命令行工具 [musicn](https://github.com/zonemeen/musicn) 的容器版本,支持 amd64/arm64 架构。
目前已不能下载无损格式。

## 部署
命令行 + Web 模式
```
docker run -d --name=musicn --restart=unless-stopped -v ${PWD}/musicn:/data -p 7478:7478 ghcr.io/wy580477/musicn-container:latest msc -q
```
仅命令行模式 (空闲时几乎不耗内存)
```
docker run -d --name=musicn --restart=unless-stopped -v ${PWD}/musicn:/data ghcr.io/wy580477/musicn-container:latest tail -f
```
${PWD}/musicn 为命令行模式下载文件存放目录,默认当前目录下 musicn 文件夹。
执行 musicn 命令:
```
docker exec -it musicn msc 周杰伦
# 设置 bash 命令别名方便使用,重新登陆 shell 后生效
echo "alias msc='docker exec -it musicn msc'" >> ~/.bashrc
# 查看命令帮助
msc -h
# 指定子目录 test 为下载目录
msc 周杰伦 -p ./test
# 升级版本
docker container rm musicn --force && docker pull ghcr.io/wy580477/musicn-container:latest
# 然后重新执行安装命令
# 容器内升级 (不推荐,万一我以后弃坑不更新 image 版本,可以用这个方法更新)
docker exec -it musicn npm i musicn -g
```
更多命令用法详见: [musicn 文档](https://github.com/zonemeen/musicn#%E6%90%9C%E7%B4%A2%E7%9A%84%E9%A1%B5%E7%A0%81%E6%95%B0%E9%BB%98%E8%AE%A4%E6%98%AF%E7%AC%AC1%E9%A1%B5)
访问 http://<宿主机 ip>:7478 可到达 Web 搜索和下载界面。(扫码访问功能不可用, 请手动输入网址访问)

### Docker-Compose 部署
命令行 + Web 模式
```
version: '3.4'
services:
musicn:
image: ghcr.io/wy580477/musicn-container:latest
container_name: musicn
restart: unless-stopped
entrypoint: ["/sbin/tini", "--", "msc", "-q"]
ports:
- "7478:7478"
volumes:
- ./musicn:/data
```
仅命令行模式
```
version: '3.4'
services:
musicn:
image: ghcr.io/wy580477/musicn-container:latest
container_name: musicn
restart: unless-stopped
entrypoint: ["/sbin/tini", "--", "tail", "-f"]
volumes:
- ./musicn:/data
```
gitextract_mw9i8qp2/ ├── .github/ │ └── workflows/ │ └── container-build-publishing.yml ├── .last_upstream_tag ├── Dockerfile ├── LICENSE └── README.md
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9K chars).
[
{
"path": ".github/workflows/container-build-publishing.yml",
"chars": 4379,
"preview": "name: Check Tag & Build\n\n# This workflow uses actions that are not certified by GitHub.\n# They are provided by a third-p"
},
{
"path": ".last_upstream_tag",
"chars": 13,
"preview": "1.5.3-beta.0\n"
},
{
"path": "Dockerfile",
"chars": 147,
"preview": "FROM node:alpine\n\nWORKDIR /data\n\nRUN apk add --no-cache tini \\\n && npm i musicn -g \\\n && rm -rf ${HOME}/.npm\n\nENTR"
},
{
"path": "LICENSE",
"chars": 1065,
"preview": "MIT License\n\nCopyright (c) 2023 wy580477\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\no"
},
{
"path": "README.md",
"chars": 2021,
"preview": "## 鸣谢\n\n- [zonemeen/musicn](https://github.com/zonemeen/musicn)\n\n## 概述\n\n可播放及下载音乐的命令行工具 [musicn](https://github.com/zoneme"
}
]
About this extraction
This page contains the full source code of the wy580477/musicn-container GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (7.4 KB), approximately 2.4k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.