Skip to content

DockerHub-Nightly

DockerHub-Nightly #368

name: DockerHub-Nightly
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
env:
TMP_LOCAL_IMAGE: localhost:5000/${{ github.repository }}
REGISTRY_IMAGE: ${{ github.repository }}
REGISTRY_TAG: nightly
VERSION: nightly
BRANCH: development
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare
run: |
mkdir -p /tmp/images
platform=${{ matrix.platform }}
echo "TARFILE=${platform//\//-}.tar" >> $GITHUB_ENV
echo "TAG=${{ env.TMP_LOCAL_IMAGE }}:${platform//\//-}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ matrix.platform }}
build-args: |
BRANCH=${{ env.BRANCH }}
VERSION=${{ env.VERSION }}
tags: ${{ env.TAG }}
outputs: type=docker,dest=/tmp/images/${{ env.TARFILE }}
- name: Load images
run: |
for image in /tmp/images/*.tar; do
docker load -i $image
done
- name: Run Docker Container and Test (1st run)
run: |
platform=${{ matrix.platform }}
docker network create --subnet=172.18.0.0/24 custom_network
docker run -d --network custom_network --ip 172.18.0.3 -p 8080:8080 -p 11470:11470 -e NO_CORS=1 -e CASTING_DISABLED=1 --platform ${{ matrix.platform }} ${{ env.TMP_LOCAL_IMAGE }}:${platform//\//-}
npm install @playwright/test
npx playwright install --with-deps
sleep 10 # wait for server to startup
cd tests
npx playwright test || (
docker ps -a;
docker logs $(docker ps -a | grep stremio | awk '{print $1}');
exit 1;
)
docker logs $(docker ps -a | grep stremio | awk '{print $1}');
docker stop $(docker ps -a | grep stremio | awk '{print $1}')
docker rm $(docker ps -a | grep stremio | awk '{print $1}')
- name: Run Docker Container and Test (2nd run with IPADDRESS)
run: |
platform=${{ matrix.platform }}
echo "172.18.0.3 172-18-0-3.519b6502d940.stremio.rocks" | sudo tee -a /etc/hosts
docker run -d --network custom_network --ip 172.18.0.3 -p 8080:8080 -p 12470:12470 -e NO_CORS=1 -e CASTING_DISABLED=1 -e IPADDRESS=172.18.0.3 -v ~/.stremio-server:/root/.stremio-server --platform ${{ matrix.platform }} ${{ env.TMP_LOCAL_IMAGE }}:${platform//\//-}
cd tests
sleep 10 # wait for server to startup
WEB_URL="https://172-18-0-3.519b6502d940.stremio.rocks:8080" SERVER_URL="https://172-18-0-3.519b6502d940.stremio.rocks:12470" npx playwright test || (
docker ps -a;
docker logs $(docker ps -a | grep stremio | awk '{print $1}');
exit 1;
)
docker logs $(docker ps -a | grep stremio | awk '{print $1}');
docker stop $(docker ps -a | grep stremio | awk '{print $1}')
docker rm $(docker ps -a | grep stremio | awk '{print $1}')
- name: Run Docker Container and Test (3rd run with CERT_FILE and DOMAIN)
run: |
platform=${{ matrix.platform }}
sudo rm -f ~/.stremio-server/httpsCert.json
docker run -d --network custom_network --ip 172.18.0.3 -p 8080:8080 -p 12470:12470 -e NO_CORS=1 -e CASTING_DISABLED=1 -e CERT_FILE=172-18-0-3.519b6502d940.stremio.rocks.pem -e DOMAIN=172-18-0-3.519b6502d940.stremio.rocks -v ~/.stremio-server:/root/.stremio-server --platform ${{ matrix.platform }} ${{ env.TMP_LOCAL_IMAGE }}:${platform//\//-}
cd tests
sleep 10 # wait for server to startup
WEB_URL="https://172-18-0-3.519b6502d940.stremio.rocks:8080" SERVER_URL="https://172-18-0-3.519b6502d940.stremio.rocks:12470" npx playwright test || (
docker ps -a;
docker logs $(docker ps -aq);
exit 1;
)
docker logs $(docker ps -a | grep stremio | awk '{print $1}');
docker stop $(docker ps -a | grep stremio | awk '{print $1}')
docker rm $(docker ps -a | grep stremio | awk '{print $1}')
- name: Upload image
uses: actions/upload-artifact@v3
with:
name: images
path: /tmp/images/${{ env.TARFILE }}
if-no-files-found: error
retention-days: 1
push:
runs-on: ubuntu-latest
needs:
- build
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Download images
uses: actions/download-artifact@v3
with:
name: images
path: /tmp/images
- name: Load images
run: |
for image in /tmp/images/*.tar; do
docker load -i $image
done
- name: Push images to local registry
run: |
docker push -a ${{ env.TMP_LOCAL_IMAGE }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASS }}
- name: Create manifest list and push
run: |
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ env.REGISTRY_TAG }} \
$(docker image ls --format '{{.Repository}}:{{.Tag}}' '${{ env.TMP_LOCAL_IMAGE }}' | tr '\n' ' ')
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.REGISTRY_TAG }}