mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 05:30:20 +00:00
Add docker caching from @JonnyWong16
This commit is contained in:
parent
4872138635
commit
81f7f9a6fc
1 changed files with 40 additions and 1 deletions
41
.github/workflows/ci.yaml
vendored
41
.github/workflows/ci.yaml
vendored
|
@ -50,6 +50,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
PLEXAPI_AUTH_SERVER_BASEURL: http://127.0.0.1:32400
|
PLEXAPI_AUTH_SERVER_BASEURL: http://127.0.0.1:32400
|
||||||
|
PLEX_CONTAINER: plexinc/pms-docker
|
||||||
PLEX_CONTAINER_TAG: latest
|
PLEX_CONTAINER_TAG: latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -83,6 +84,44 @@ jobs:
|
||||||
pip install -r requirements_dev.txt
|
pip install -r requirements_dev.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
|
- name: Get PMS Docker image digest
|
||||||
|
id: docker-digest
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.cache/docker/${{ env.PLEX_CONTAINER }}
|
||||||
|
echo "Image: ${{ env.PLEX_CONTAINER }}"
|
||||||
|
echo "Tag: ${{ env.PLEX_CONTAINER_TAG }}"
|
||||||
|
token=$(curl \
|
||||||
|
--silent \
|
||||||
|
"https://auth.docker.io/token?scope=repository:${{ env.PLEX_CONTAINER }}:pull&service=registry.docker.io" \
|
||||||
|
| jq -r '.token')
|
||||||
|
digest=$(curl \
|
||||||
|
--silent \
|
||||||
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
|
--header "Authorization: Bearer $token" \
|
||||||
|
"https://registry-1.docker.io/v2/${{ env.PLEX_CONTAINER }}/manifests/${{ env.PLEX_CONTAINER_TAG }}" \
|
||||||
|
| jq -r '.config.digest')
|
||||||
|
echo "Digest: $digest"
|
||||||
|
echo ::set-output name=digest::$digest
|
||||||
|
|
||||||
|
- name: Cache PMS Docker image
|
||||||
|
id: docker-cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/docker/plexinc
|
||||||
|
key: ${{ runner.os }}-docker-pms-${{ steps.docker-digest.outputs.digest }}
|
||||||
|
|
||||||
|
- name: Pull PMS Docker image
|
||||||
|
if: steps.docker-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
docker pull ${{ env.PLEX_CONTAINER }}:${{ env.PLEX_CONTAINER_TAG }}
|
||||||
|
docker save -o ~/.cache/docker/${{ env.PLEX_CONTAINER }}-${{ env.PLEX_CONTAINER_TAG }}.tar ${{ env.PLEX_CONTAINER }}:${{ env.PLEX_CONTAINER_TAG }}
|
||||||
|
echo "Saved image: ${{ env.PLEX_CONTAINER }}:${{ env.PLEX_CONTAINER_TAG }}"
|
||||||
|
|
||||||
|
- name: Load PMS Docker image
|
||||||
|
if: steps.docker-cache.outputs.cache-hit == 'true'
|
||||||
|
run: |
|
||||||
|
docker load -i ~/.cache/docker/${{ env.PLEX_CONTAINER }}-${{ env.PLEX_CONTAINER_TAG }}.tar
|
||||||
|
|
||||||
- name: Set Plex credentials
|
- name: Set Plex credentials
|
||||||
if: matrix.plex == 'claimed'
|
if: matrix.plex == 'claimed'
|
||||||
run: |
|
run: |
|
||||||
|
@ -94,7 +133,7 @@ jobs:
|
||||||
python \
|
python \
|
||||||
-u tools/plex-bootstraptest.py \
|
-u tools/plex-bootstraptest.py \
|
||||||
--destination plex \
|
--destination plex \
|
||||||
--advertise-ip=127.0.0.1 \
|
--advertise-ip 127.0.0.1 \
|
||||||
--bootstrap-timeout 540 \
|
--bootstrap-timeout 540 \
|
||||||
--docker-tag ${{ env.PLEX_CONTAINER_TAG }} \
|
--docker-tag ${{ env.PLEX_CONTAINER_TAG }} \
|
||||||
--${{ matrix.plex }}
|
--${{ matrix.plex }}
|
||||||
|
|
Loading…
Reference in a new issue