From c4d7e300e2b8ac0ef488dd7df8255b807f438edd Mon Sep 17 00:00:00 2001 From: DARKZOUL5 Date: Wed, 15 Oct 2025 12:56:02 +0300 Subject: [PATCH] Add Docker workflow and Dockerfile for building and pushing images to Gitea registry --- .gitea/workflows/build-docker-image.yml | 56 +++++++++++++++++++++++++ Dockerfile | 8 ++++ 2 files changed, 64 insertions(+) create mode 100644 .gitea/workflows/build-docker-image.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/build-docker-image.yml b/.gitea/workflows/build-docker-image.yml new file mode 100644 index 0000000..b7ca853 --- /dev/null +++ b/.gitea/workflows/build-docker-image.yml @@ -0,0 +1,56 @@ +# Build and push Docker image to Gitea container registry +name: Build and Push Docker Image + +on: + push: + tags: + - "v*.*.*" + +jobs: + build-and-push: + runs-on: ubuntu-latest + env: + REGISTRY: git.darkzoul.org/dark_zoul/YouTube-Playlist-Downloader # <-- Use your actual Gitea registry URL + IMAGE_NAME: youtube-playlist-downloader + steps: + - name: Checkout code + uses: https://gitea.com/actions/checkout@v5 + + + - name: Download linux-zip artifact + uses: christopherhx/gitea-download-artifact@v4 + with: + name: linux-zip + path: ./artifact + + - name: Unpack linux-zip artifact + run: | + unzip ./artifact/*.zip -d ./docker-src + + - name: Copy Dockerfile to build context + run: cp Dockerfile ./docker-src/ + + + - name: Extract tag name + run: | + REF="${GITEA_REF:-$GITHUB_REF}" + TAG="${REF#refs/tags/}" + echo "TAG=$TAG" >> $GITHUB_ENV + + - name: Build Docker image with release tag + run: docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} ./docker-src + + - name: Tag Docker image as latest + run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + + - name: Push Docker image with release tag + run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} + + - name: Push Docker image as latest + run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + + - name: Log in to Gitea registry + run: echo ${{ secrets.DOCKER_BUILD_KEY }} | docker login ${{ env.REGISTRY }} -u ${{ secrets.GITEA_REGISTRY_USERNAME }} --password-stdin + + - name: Push Docker image + run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1d194dd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.12-slim +WORKDIR /app +COPY yt-playlist-main.py /app/ +COPY bin/aria2c.exe /app/bin/ +COPY bin/ffmpeg.exe /app/bin/ +COPY bin/yt-dlp.exe /app/bin/ +ENV PATH="/app/bin:$PATH" +CMD ["python", "yt-playlist-main.py"]