Skip to content

Commit 32a6bdd

Browse files
authored
DockerfileBase (#1410)
1 parent 3672058 commit 32a6bdd

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.github/workflows/dockerfile-base.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
name: lib
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: >-
9+
${{
10+
github.workflow
11+
}}-${{
12+
github.event.pull_request.number || github.sha
13+
}}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
pre-setup:
18+
name: ⚙️ Pre-set global build settings
19+
runs-on: ubuntu-20.04
20+
defaults:
21+
run:
22+
shell: bash
23+
outputs:
24+
container-platforms: ${{ steps.container.outputs.platforms }}
25+
steps:
26+
- name: Calculate container attributes
27+
id: container
28+
shell: bash
29+
run: >-
30+
PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x";
31+
echo "::set-output name=platforms::$PLATFORMS"
32+
33+
ghcr-latest:
34+
runs-on: ubuntu-20.04
35+
permissions:
36+
packages: write
37+
if: success()
38+
needs:
39+
- pre-setup # transitive, for accessing settings
40+
name: 🐳 ghcr:latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v3
44+
with:
45+
ref: ${{ github.event.inputs.release-commitish }}
46+
- name: Login to GHCR
47+
uses: docker/login-action@v2
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Set up Docker Buildx
53+
id: buildx
54+
uses: docker/setup-buildx-action@v2
55+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
56+
with:
57+
version: v0.7.0
58+
buildkitd-flags: --debug
59+
config: .github/buildkitd.toml
60+
install: true
61+
- name: Enable Multiarch # This slows down arm build by 4-5x
62+
run: |
63+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
64+
- name: Create builder
65+
run: |
66+
docker buildx create --name proxypybuilder
67+
docker buildx use proxypybuilder
68+
docker buildx inspect
69+
docker buildx ls
70+
- name: Push base to GHCR
71+
run: >-
72+
docker buildx build
73+
--push
74+
--platform ${{
75+
needs.pre-setup.outputs.container-platforms
76+
}}
77+
-t ghcr.io/abhinavsingh/proxy.py:base
78+
-f DockerfileBase .
79+
...

DockerfileBase

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.11-alpine
2+
3+
LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \
4+
com.abhinavsingh.description="⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • \
5+
😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • \
6+
👮🏿 \"Proxy Server\" framework • 🌐 \"Web Server\" framework • ➵ ➶ ➷ ➠ \"PubSub\" framework • \
7+
👷 \"Work\" acceptor & executor framework" \
8+
com.abhinavsingh.url="https://github.com/abhinavsingh/proxy.py" \
9+
com.abhinavsingh.vcs-url="https://github.com/abhinavsingh/proxy.py" \
10+
com.abhinavsingh.docker.cmd="docker run -it --rm -p 8899:8899 abhinavsingh/proxy.py" \
11+
org.opencontainers.image.source="https://github.com/abhinavsingh/proxy.py"
12+
13+
ENV PYTHONUNBUFFERED 1
14+
15+
# Install paramiko and cryptography to allow
16+
# users to use tunneling features using Docker
17+
RUN apk update && apk --no-cache add \
18+
--virtual .builddeps \
19+
gcc \
20+
musl-dev \
21+
libffi-dev \
22+
openssl-dev \
23+
python3-dev \
24+
cargo \
25+
rust \
26+
make
27+
RUN python -m venv /proxy/venv && \
28+
/proxy/venv/bin/pip install \
29+
-U pip wheel && \
30+
/proxy/venv/bin/pip install \
31+
paramiko==3.4.0 \
32+
cryptography==39.0.1 \
33+
--prefer-binary
34+
RUN apk del .builddeps

0 commit comments

Comments
 (0)