Tor support, use SeleniumBase instead of DrissionPage (#123)

Refactor: Improve Docker build, add Tor support, use SeleniumBase

- Overhauled Dockerfile:
    - Switched to python:3.10-slim base.
    - Implemented multi-stage builds (base, standard, tor).
    - Consolidated RUN layers for efficiency.
    - Added locale/timezone setup.
- Added Tor setup and iptables configuration in dedicated stage/script.
- Replaced DrissionPage with SeleniumBase for Cloudflare bypassing.
- Added Tor support via `docker-compose.tor.yml` and `tor.sh` script.
- Updated `docker-compose.yml` to build locally and changed default port
to 8083.
- Added `docker-compose.dev.yml` and `docker-compose.tor.dev.yml`.
- Updated `entrypoint.sh` for timezone and sudo usage.
- Added/Updated environment variables (`TZ`, `USING_TOR`, etc.).
- Improved `.dockerignore`.
- Updated `readme.md` to reflect port changes, build process, document
`TZ`, and add details about the new Tor variant.
This commit is contained in:
CaliBrain
2025-04-13 02:34:39 -04:00
committed by GitHub
parent e0e7470ac6
commit 57f15b4d95
18 changed files with 602 additions and 277 deletions
@@ -1,4 +1,4 @@
name: Create and publish a Docker image
name: Create and publish Docker images
on:
push:
@@ -10,7 +10,7 @@ env:
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
@@ -26,8 +26,10 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
# Build and push main image
- name: Extract metadata for main image
id: meta-main
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
@@ -36,23 +38,57 @@ jobs:
type=raw,value={{commit_date 'YYYYMMDD'}}
type=sha
type=ref,event=branch
type=ref,event=tag
type=ref,event=tag
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: push
- name: Build and push main Docker image
id: push-main
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
target: cwa-bd
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-main.outputs.tags }}
labels: ${{ steps.meta-main.outputs.labels }}
- name: Generate artifact attestation
- name: Generate artifact attestation for main image
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push-main.outputs.digest }}
push-to-registry: true
# Build and push tor image
- name: Extract metadata for tor image
id: meta-tor
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-tor
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{commit_date 'YYYYMMDD'}}
type=sha
type=ref,event=branch
type=ref,event=tag
- name: Build and push tor Docker image
id: push-tor
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
target: cwa-bd-tor
push: true
tags: ${{ steps.meta-tor.outputs.tags }}
labels: ${{ steps.meta-tor.outputs.labels }}
- name: Generate artifact attestation for tor image
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-tor
subject-digest: ${{ steps.push-tor.outputs.digest }}
push-to-registry: true