diff --git a/.env.example b/.env.example index 45ed94f..a8ee9cf 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,6 @@ # for caddy CLOUDFLARE_DNS_API_TOKEN=xxxx -SCHEME=http BASE_DOMAIN=local.homeinfra.org # for aria2 and mirrors diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..56bb830 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,51 @@ +name: Manual CI + +on: + workflow_dispatch: + +jobs: + integration-tests: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - 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: noclin + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.9" + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + context: ./src + tags: ghcr.io/noclin/lightmirrors:${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + context: ./aria2 + tags: ghcr.io/noclin/lightmirrors_aria2:${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Integration Test + run: python3 test/runner.py \ No newline at end of file diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..d5e4f15 --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1 @@ +**/__pycache__ \ No newline at end of file diff --git a/src/Dockerfile b/src/Dockerfile index 88f731c..270db0b 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -9,7 +9,9 @@ RUN unzip AriaNg-1.3.7.zip && rm AriaNg-1.3.7.zip ADD requirements.txt /app/requirements.txt -RUN pip install -r /app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ +RUN pip install -r /app/requirements.txt + +ADD . /app WORKDIR /app