diff --git a/.github/workflows/dockerfile-base.yml b/.github/workflows/dockerfile-base.yml new file mode 100644 index 00000000..eb83bf98 --- /dev/null +++ b/.github/workflows/dockerfile-base.yml @@ -0,0 +1,79 @@ +--- +name: lib + +on: # yamllint disable-line rule:truthy + workflow_dispatch: + +concurrency: + group: >- + ${{ + github.workflow + }}-${{ + github.event.pull_request.number || github.sha + }} + cancel-in-progress: true + +jobs: + pre-setup: + name: ⚙️ Pre-set global build settings + runs-on: ubuntu-20.04 + defaults: + run: + shell: bash + outputs: + container-platforms: ${{ steps.container.outputs.platforms }} + steps: + - name: Calculate container attributes + id: container + shell: bash + run: >- + PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x"; + echo "::set-output name=platforms::$PLATFORMS" + + ghcr-latest: + runs-on: ubuntu-20.04 + permissions: + packages: write + if: success() + needs: + - pre-setup # transitive, for accessing settings + name: 🐳 ghcr:latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.release-commitish }} + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + # See https://github.com/docker/buildx/issues/850#issuecomment-996408167 + with: + version: v0.7.0 + buildkitd-flags: --debug + config: .github/buildkitd.toml + install: true + - name: Enable Multiarch # This slows down arm build by 4-5x + run: | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - name: Create builder + run: | + docker buildx create --name proxypybuilder + docker buildx use proxypybuilder + docker buildx inspect + docker buildx ls + - name: Push base to GHCR + run: >- + docker buildx build + --push + --platform ${{ + needs.pre-setup.outputs.container-platforms + }} + -t ghcr.io/abhinavsingh/proxy.py:base + -f DockerfileBase . +... diff --git a/DockerfileBase b/DockerfileBase new file mode 100644 index 00000000..2440bfef --- /dev/null +++ b/DockerfileBase @@ -0,0 +1,34 @@ +FROM python:3.11-alpine + +LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \ + com.abhinavsingh.description="⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • \ + 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • \ + 👮🏿 \"Proxy Server\" framework • 🌐 \"Web Server\" framework • ➵ ➶ ➷ ➠ \"PubSub\" framework • \ + 👷 \"Work\" acceptor & executor framework" \ + com.abhinavsingh.url="https://github.com/abhinavsingh/proxy.py" \ + com.abhinavsingh.vcs-url="https://github.com/abhinavsingh/proxy.py" \ + com.abhinavsingh.docker.cmd="docker run -it --rm -p 8899:8899 abhinavsingh/proxy.py" \ + org.opencontainers.image.source="https://github.com/abhinavsingh/proxy.py" + +ENV PYTHONUNBUFFERED 1 + +# Install paramiko and cryptography to allow +# users to use tunneling features using Docker +RUN apk update && apk --no-cache add \ + --virtual .builddeps \ + gcc \ + musl-dev \ + libffi-dev \ + openssl-dev \ + python3-dev \ + cargo \ + rust \ + make +RUN python -m venv /proxy/venv && \ + /proxy/venv/bin/pip install \ + -U pip wheel && \ + /proxy/venv/bin/pip install \ + paramiko==3.4.0 \ + cryptography==39.0.1 \ + --prefer-binary +RUN apk del .builddeps