diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 93e1a37..46e5c4c 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -18,12 +18,19 @@ concurrency: jobs: prepare: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write outputs: alist_tags: ${{ steps.vars.outputs.alist_tags }} metadata_tags: ${{ steps.vars.outputs.metadata_tags }} embyserver_tags: ${{ steps.vars.outputs.embyserver_tags }} - embyhack_tags: ${{ steps.vars.outputs.embyhack_tags }} + embyserver-amilys_tags: ${{ steps.vars.outputs.embyserver-amilys_tags }} jellyfin_tags: ${{ steps.vars.outputs.jellyfin_tags }} + jellyfin-nyanmisaka_tags: ${{ steps.vars.outputs.jellyfin-nyanmisaka_tags }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -32,21 +39,52 @@ jobs: id: vars run: | IMAGE_PREFIX="ghcr.io/${{ github.repository_owner }}" + vars=( + "alist" + "metadata" + "embyserver" + "embyserver-amilys" + "jellyfin" + "jellyfin-nyanmisaka" + ) if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} - echo "::set-output name=alist_tags::${IMAGE_PREFIX}/xiaoya-alist:latest,${IMAGE_PREFIX}/xiaoya-alist:${VERSION}" - echo "::set-output name=metadata_tags::${IMAGE_PREFIX}/xiaoya-metadata:latest,${IMAGE_PREFIX}/xiaoya-metadata:${VERSION}" - echo "::set-output name=embyserver_tags::${IMAGE_PREFIX}/xiaoya-embyserver:latest,${IMAGE_PREFIX}/xiaoya-embyserver:${VERSION}" - echo "::set-output name=embyhack_tags::${IMAGE_PREFIX}/xiaoya-embyhack:latest,${IMAGE_PREFIX}/xiaoya-embyhack:${VERSION}" - echo "::set-output name=jellyfin_tags::${IMAGE_PREFIX}/xiaoya-jellyfin:latest,${IMAGE_PREFIX}/xiaoya-jellyfin:${VERSION}" + for var in "${vars[@]}"; do + echo "::set-output name=${var}_tags::${IMAGE_PREFIX}/xiaoya-${var}:latest,${IMAGE_PREFIX}/xiaoya-${var}:${VERSION}" + done else LATEST_TAG=${GITHUB_REF#refs/heads/} - echo "::set-output name=alist_tags::${IMAGE_PREFIX}/xiaoya-alist:${LATEST_TAG}" - echo "::set-output name=metadata_tags::${IMAGE_PREFIX}/xiaoya-metadata:${LATEST_TAG}" - echo "::set-output name=embyserver_tags::${IMAGE_PREFIX}/xiaoya-embyserver:${LATEST_TAG}" - echo "::set-output name=embyhack_tags::${IMAGE_PREFIX}/xiaoya-embyhack:${LATEST_TAG}" - echo "::set-output name=jellyfin_tags::${IMAGE_PREFIX}/xiaoya-jellyfin:${LATEST_TAG}" + for var in "${vars[@]}"; do + echo "::set-output name=${var}_tags::${IMAGE_PREFIX}/xiaoya-${var}:${LATEST_TAG}" + done fi + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build base image + run: | + docker buildx imagetools create \ + --tag ghcr.io/monlor/embyserver:latest \ + amilys/embyserver:latest \ + amilys/embyserver_arm64v8:latest + + docker buildx imagetools create \ + --tag ghcr.io/monlor/embyserver-amilys:latest \ + amilys/embyserver:latest \ + amilys/embyserver_arm64v8:latest + + docker buildx imagetools create \ + --tag ghcr.io/monlor/jellyfin-nyanmisaka:latest \ + nyanmisaka/jellyfin:240401-amd64 \ + nyanmisaka/jellyfin:240401-arm64 build-alist: runs-on: ubuntu-latest @@ -179,19 +217,19 @@ jobs: tags: ${{ needs.prepare.outputs.embyserver_tags }} platforms: linux/amd64,linux/arm64 build-args: | - BASE_IMAGE=embyserver + BASE_IMAGE=ghcr.io/monlor/embyserver:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - - name: Build and push xiaoya-embyhack + - name: Build and push xiaoya-embyserver-amilys uses: docker/build-push-action@v4 with: context: ./emby push: true - tags: ${{ needs.prepare.outputs.embyhack_tags }} + tags: ${{ needs.prepare.outputs.embyserver-amilys_tags }} platforms: linux/amd64,linux/arm64 build-args: | - BASE_IMAGE=embyhack + BASE_IMAGE=ghcr.io/monlor/embyserver-amilys:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new @@ -238,6 +276,20 @@ jobs: push: true tags: ${{ needs.prepare.outputs.jellyfin_tags }} platforms: linux/amd64,linux/arm64 + build-args: | + BASE_IMAGE=jellyfin/jellyfin:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Build and push xiaoya-jellyfin-nyanmisaka + uses: docker/build-push-action@v4 + with: + context: ./jellyfin + push: true + tags: ${{ needs.prepare.outputs.jellyfin-nyanmisaka_tags }} + platforms: linux/amd64,linux/arm64 + build-args: | + BASE_IMAGE=ghcr.io/monlor/jellyfin-nyanmisaka:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new diff --git a/alist/README.md b/alist/README.md index 1b47c19..66c7600 100644 --- a/alist/README.md +++ b/alist/README.md @@ -38,9 +38,9 @@ docker run -d -p 5678:80 -p 2345:2345 -p 2346:2346 --restart=unless-stopped --na `WEBDAV_PASSWORD`: webdav用户名为dav,设置密码。默认用户密码:guest/guest_Api789 -`EMBY_ADDR`: emby部署地址,默认http://emby:6908 +`EMBY_ADDR`: emby部署地址,默认http://emby:6908,容器内部使用地址,一般不用改 -`JELLYFIN_ADDR`: jellyfin部署地址,默认http://jellyfin:8096 +`JELLYFIN_ADDR`: jellyfin部署地址,默认http://jellyfin:8096,容器内部使用地址,一般不用改 `EMBY_APIKEY`: 填入一个emby的api key,用于在infuse中播放emby diff --git a/emby/.dockerignore b/emby/.dockerignore deleted file mode 100644 index 81d87ee..0000000 --- a/emby/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -create_embyserver.sh \ No newline at end of file diff --git a/emby/Dockerfile b/emby/Dockerfile index 6234ec5..e9cb3a8 100644 --- a/emby/Dockerfile +++ b/emby/Dockerfile @@ -1,6 +1,6 @@ -ARG BASE_IMAGE=embyserver +ARG BASE_IMAGE=ghcr.io/monlor/embyserver:latest -FROM monlor/${BASE_IMAGE}:latest +FROM ${BASE_IMAGE} LABEL MAINTAINER me@monlor.com diff --git a/emby/README.md b/emby/README.md index 4ab2142..aa5fc4e 100644 --- a/emby/README.md +++ b/emby/README.md @@ -5,10 +5,10 @@ ## 环境变量 -`ALIST_ADDR`: 小雅alist的地址,默认http://alist:5678 +`ALIST_ADDR`: 小雅alist的地址,默认http://alist:5678,容器内部使用地址,一般不用改 -## 开心版镜像 +## 其他镜像 ``` -ghcr.io/monlor/xiaoya-embyhack +ghcr.io/monlor/xiaoya-embyserver-amilys ``` \ No newline at end of file diff --git a/emby/create_embyserver.sh b/emby/create_embyserver.sh deleted file mode 100755 index 37e7807..0000000 --- a/emby/create_embyserver.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -docker pull amilys/embyserver:latest -docker pull amilys/embyserver_arm64v8:latest - -docker buildx imagetools create \ - --tag monlor/embyhack:latest \ - amilys/embyserver:latest \ - amilys/embyserver_arm64v8:latest - -docker pull emby/embyserver:latest -docker pull emby/embyserver_arm64v8:latest - -docker buildx imagetools create \ - --tag monlor/embyserver:latest \ - amilys/embyserver:latest \ - amilys/embyserver_arm64v8:latest \ No newline at end of file diff --git a/env b/env index 86d5fd3..6732dc0 100644 --- a/env +++ b/env @@ -20,9 +20,11 @@ FORCE_LOGIN= # webdav用户名为dav,设置密码。默认用户密码:guest/guest_Api789 WEBDAV_PASSWORD= -# emby 地址 +# emby 地址,容器内部使用地址,一般不用改 EMBY_ADDR=http://emby:6908 -# alist 地址 +# jellyfin 地址,容器内部使用地址,一般不用改 +JELLYFIN_ADDR=http://jellyfin:8096 +# alist 地址,容器内部使用地址,一般不用改 ALIST_ADDR=http://alist:5678 # 是否启用emby diff --git a/jellyfin/Dockerfile b/jellyfin/Dockerfile index 07a7197..7e44eb5 100644 --- a/jellyfin/Dockerfile +++ b/jellyfin/Dockerfile @@ -1,4 +1,6 @@ -FROM jellyfin/jellyfin +ARG BASE_IMAGE=jellyfin/jellyfin:latest + +FROM ${BASE_IMAGE} LABEL MAINTAINER me@monlor.com diff --git a/jellyfin/README.md b/jellyfin/README.md index f360d86..d04bd6f 100644 --- a/jellyfin/README.md +++ b/jellyfin/README.md @@ -1,3 +1,9 @@ ## 环境变量 -`ALIST_ADDR`: 小雅alist的地址,默认http://alist:5678 \ No newline at end of file +`ALIST_ADDR`: 小雅alist的地址,默认http://alist:5678,容器内部使用地址,一般不用改 + +## 其他镜像 + +``` +ghcr.io/monlor/xiaoya-jellyfin-nyanmisaka +``` \ No newline at end of file diff --git a/jellyfin/update_alist_addr.sh b/jellyfin/update_alist_addr.sh index ed050c0..1fd61b0 100644 --- a/jellyfin/update_alist_addr.sh +++ b/jellyfin/update_alist_addr.sh @@ -21,7 +21,7 @@ if echo "${ALIST_DOMAIN}" | grep -E -q '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0- fi while true; do - IP=$(nslookup "${ALIST_DOMAIN}" | awk '/^Address: / { print $2 }' | tail -n 1) + IP=$(ping -c 1 "${ALIST_DOMAIN}" | grep -Eo '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' | head -n 1) if [ -n "$IP" ]; then echo "Alist IP address: $IP" add_hosts "$IP"