|
1 |
| -FROM python:3.11-alpine as base |
| 1 | +FROM ghcr.io/abhinavsingh/proxy.py:base as builder |
2 | 2 |
|
3 | 3 | LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \
|
4 |
| - com.abhinavsingh.description="⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • \ |
| 4 | + org.opencontainers.image.title="proxy.py" \ |
| 5 | + org.opencontainers.image.description="⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • \ |
5 | 6 | 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • \
|
6 | 7 | 👮🏿 \"Proxy Server\" framework • 🌐 \"Web Server\" framework • ➵ ➶ ➷ ➠ \"PubSub\" framework • \
|
7 | 8 | 👷 \"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" \ |
| 9 | + org.opencontainers.url="https://github.com/abhinavsingh/proxy.py" \ |
| 10 | + org.opencontainers.image.source="https://github.com/abhinavsingh/proxy.py" \ |
10 | 11 | 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 | + org.opencontainers.image.licenses="BSD-3-Clause" \ |
| 13 | + org.opencontainers.image.authors="Abhinav Singh <mailsforabhinav@gmail.com>" \ |
| 14 | + org.opencontainers.image.vendor="Abhinav Singh" |
12 | 15 |
|
13 | 16 | ENV PYTHONUNBUFFERED 1
|
| 17 | +ENV PYTHONDONTWRITEBYTECODE 1 |
14 | 18 |
|
15 | 19 | ARG SKIP_OPENSSL
|
16 | 20 | ARG PROXYPY_PKG_PATH
|
17 | 21 |
|
18 | 22 | COPY README.md /
|
19 | 23 | COPY $PROXYPY_PKG_PATH /
|
20 | 24 |
|
21 |
| -RUN pip install --upgrade pip && \ |
22 |
| - pip install \ |
| 25 | +# proxy.py itself needs no external dependencies |
| 26 | +# Optionally, include openssl to allow |
| 27 | +# users to use TLS interception features using Docker |
| 28 | +# Use `--build-arg SKIP_OPENSSL=1` to disable openssl installation |
| 29 | +RUN /proxy/venv/bin/pip install --no-compile --no-cache-dir \ |
| 30 | + -U pip && \ |
| 31 | + /proxy/venv/bin/pip install --no-compile --no-cache-dir \ |
23 | 32 | --no-index \
|
24 | 33 | --find-links file:/// \
|
25 | 34 | proxy.py && \
|
26 |
| - rm *.whl |
27 |
| - |
28 |
| -# Use `--build-arg SKIP_OPENSSL=1` to disable openssl installation |
29 |
| -RUN if [[ -z "$SKIP_OPENSSL" ]]; then apk update && apk add openssl; fi |
| 35 | + rm *.whl && \ |
| 36 | + find . -type d -name '__pycache__' | xargs rm -rf && \ |
| 37 | + rm -rf /var/cache/apk/* && \ |
| 38 | + rm -rf /root/.cache/ && \ |
| 39 | + /proxy/venv/bin/pip uninstall -y wheel setuptools pip && \ |
| 40 | + /usr/local/bin/pip uninstall -y wheel setuptools pip |
30 | 41 |
|
| 42 | +FROM python:3.11-alpine |
| 43 | +COPY --from=builder /README.md /README.md |
| 44 | +COPY --from=builder /proxy /proxy |
| 45 | +RUN if [[ -z "$SKIP_OPENSSL" ]]; then \ |
| 46 | + apk update && \ |
| 47 | + apk --no-cache add openssl && \ |
| 48 | + rm -rf /var/cache/apk/* && \ |
| 49 | + rm -rf /root/.cache/; \ |
| 50 | + fi |
| 51 | +ENV PATH="/proxy/venv/bin:${PATH}" |
31 | 52 | EXPOSE 8899/tcp
|
32 | 53 | ENTRYPOINT [ "proxy" ]
|
33 | 54 | CMD [ \
|
|
0 commit comments