DockerfileBase (#1410)

This commit is contained in:
Abhinav Singh 2024-05-15 16:36:49 +05:30 committed by GitHub
parent 367205826d
commit 32a6bdd47f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 113 additions and 0 deletions

79
.github/workflows/dockerfile-base.yml vendored Normal file
View File

@ -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 .
...

34
DockerfileBase Normal file
View File

@ -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