From 34bdc8b59b24caf567d38cf3358f23d5ce1f11fd Mon Sep 17 00:00:00 2001 From: thuanle Date: Fri, 11 Jul 2025 12:04:43 +0700 Subject: [PATCH] Add Docker configuration files for Privoxy setup --- .gitea/workflows/build-docker.yml | 66 +++++++++++++++++++++++++++++++ Dockerfile | 7 ++++ docker-compose.yml | 8 ++++ 3 files changed, 81 insertions(+) create mode 100644 .gitea/workflows/build-docker.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitea/workflows/build-docker.yml b/.gitea/workflows/build-docker.yml new file mode 100644 index 0000000..06a16dc --- /dev/null +++ b/.gitea/workflows/build-docker.yml @@ -0,0 +1,66 @@ +name: Weekly Docker Build + +on: + schedule: + - cron: '0 0 * * 0' # 00:00 sáng Chủ nhật hằng tuần (UTC) + workflow_dispatch: # Cho phép chạy tay nếu cần + +env: + IMAGE_PATH: git.thuanle.me/public/privoxy-docker + +jobs: + build: + strategy: + matrix: + arch: + - amd64 + - arm64 + runs-on: ${{ matrix.arch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history, keeping all commits + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.thuanle.me + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker images + run: | + echo "Building image for architecture: ${{ matrix.arch }}" + + docker build \ + -f Dockerfile \ + -t ${{ env.IMAGE_PATH }}:${{ matrix.arch }}-latest \ + --label "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ + --label "commit_sha=${{ github.sha }}" \ + . + + docker push ${{ env.IMAGE_PATH }}:${{ matrix.arch }}-latest + + amend-manifest: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.thuanle.me + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker manifest + run: | + echo "Delete existing manifest" + docker manifest rm ${{ env.IMAGE_PATH }}:latest || true + + echo "Create new manifest" + docker manifest create ${{ env.IMAGE_PATH }}:latest \ + ${{ env.IMAGE_PATH }}:amd64-latest \ + ${{ env.IMAGE_PATH }}:arm64-latest + + docker manifest push ${{ env.IMAGE_PATH }}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96406de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:latest + +RUN apk add --no-cache privoxy + +COPY config /etc/privoxy/config + +CMD ["privoxy", "--no-daemon", "/etc/privoxy/config"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d2c80a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + privoxy: + image: git.thuanle.me/public/privoxy-docker:latest + restart: unless-stopped + ports: + - "8118:8118" + volumes: + - ./config:/etc/privoxy \ No newline at end of file