penguin/tinyproxy

An L4 proxy designed to act as a tiny transparent shim

commit 937c86faf3677c25034d9cecd0d5eda71ae7bbb5

author斟酌 鵬兄 <tgckpg@gmail.com>
date2026-06-09T22:02:52Z
subjectAdded debian-slim image
commit 937c86faf3677c25034d9cecd0d5eda71ae7bbb5
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2026-06-09T22:02:52Z

    Added debian-slim image
---
 .github/workflows/cmake-multi-platform.yml         | 64 ++++++++++++++++++----
 .gitignore                                         |  1 +
 Dockerfile => dockerfiles/alpine.Dockerfile        |  0
 .../github-minimal.Dockerfile                      |  0
 dockerfiles/github-perf.Dockerfile                 | 32 +++++++++++
 5 files changed, 87 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml
index 36b1cae..4734df7 100644
--- a/.github/workflows/cmake-multi-platform.yml
+++ b/.github/workflows/cmake-multi-platform.yml
@@ -69,7 +69,7 @@ jobs:
           name: libevent-tarball
           path: .cache/libevent
 
-      - &extract_libevent_build
+      - &extract_libevent
         name: Extract libevent source
         run: |
           set -eu
@@ -183,7 +183,7 @@ jobs:
 
       - *checkout
       - *download_libevent_source
-      - *extract_libevent_build
+      - *extract_libevent
       - *install_linux_deps
       - *build_static
       - *verify_static
@@ -221,7 +221,7 @@ jobs:
                 python3 \
                 ca-certificates
 
-              make clean all LIBEVENT_SRC=./libevent
+              make clean all
 
               make test \
                 CONCURRENCY=20 \
@@ -469,8 +469,8 @@ jobs:
             gh release upload "$tag" "$asset"
           done
 
-  docker:
-    name: Docker image
+  docker-min:
+    name: Docker image (minimal)
     runs-on: ubuntu-latest
 
     if: startsWith(github.ref, 'refs/tags/v')
@@ -484,7 +484,7 @@ jobs:
       packages: write
 
     steps:
-      - uses: actions/checkout@v4
+      - *checkout
 
       - name: Download Linux artifacts
         uses: actions/download-artifact@v4
@@ -515,15 +515,18 @@ jobs:
           file rootfs-amd64/usr/bin/tinyproxy
           file rootfs-arm64/usr/bin/tinyproxy
 
-      - name: Set image name
+      - &set_image_name
+        name: Set image name
         run: |
           image="ghcr.io/${GITHUB_REPOSITORY}"
           echo "IMAGE_NAME=${image,,}" >> "$GITHUB_ENV"
 
-      - name: Set up Docker Buildx
+      - &setup_buildx
+        name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v4
 
-      - name: Login to GHCR
+      - &login_ghcr
+        name: Login to GHCR
         uses: docker/login-action@v4
         with:
           registry: ghcr.io
@@ -534,7 +537,7 @@ jobs:
         uses: docker/build-push-action@v7
         with:
           context: .
-          file: ./github.Dockerfile
+          file: ./dockerfiles/github-minimal.Dockerfile
           platforms: linux/amd64,linux/arm64
           push: true
           tags: |
@@ -543,3 +546,44 @@ jobs:
             org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
             org.opencontainers.image.version=${{ github.ref_name }}
             org.opencontainers.image.revision=${{ github.sha }}
+
+  docker-perf:
+    name: Docker image (performance)
+    runs-on: ubuntu-latest
+
+    if: startsWith(github.ref, 'refs/tags/v')
+
+    needs:
+      - libevent-source
+
+    permissions:
+      contents: read
+      packages: write
+
+    steps:
+      - *checkout
+      - *download_libevent_source
+
+      - name: Stage libevent tarball for Docker build
+        run: |
+          cp ".cache/libevent/${LIBEVENT_TARBALL}" "./${LIBEVENT_TARBALL}"
+
+      - *set_image_name
+      - *setup_buildx
+      - *login_ghcr
+
+      - name: Build and push image
+        uses: docker/build-push-action@v7
+        with:
+          context: .
+          file: ./dockerfiles/github-perf.Dockerfile
+          platforms: linux/amd64,linux/arm64
+          push: true
+          build-args: |
+            LIBEVENT_TARBALL=${{ env.LIBEVENT_TARBALL }}
+          tags: |
+            ${{ env.IMAGE_NAME }}:${{ github.ref_name }}-debian-slim
+          labels: |
+            org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
+            org.opencontainers.image.version=${{ github.ref_name }}-debian-slim
+            org.opencontainers.image.revision=${{ github.sha }}
diff --git a/.gitignore b/.gitignore
index 5c24ce0..e63d3b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ libevent2/
 __pycache__
 *.log
 *.swp
+*.tar.gz
 .DS_Store
 
 # Generated man pages from scdoc
diff --git a/Dockerfile b/dockerfiles/alpine.Dockerfile
similarity index 100%
rename from Dockerfile
rename to dockerfiles/alpine.Dockerfile
diff --git a/github.Dockerfile b/dockerfiles/github-minimal.Dockerfile
similarity index 100%
rename from github.Dockerfile
rename to dockerfiles/github-minimal.Dockerfile
diff --git a/dockerfiles/github-perf.Dockerfile b/dockerfiles/github-perf.Dockerfile
new file mode 100644
index 0000000..f791eb5
--- /dev/null
+++ b/dockerfiles/github-perf.Dockerfile
@@ -0,0 +1,32 @@
+FROM debian:trixie-slim AS build
+
+ARG LIBEVENT_TARBALL
+
+RUN apt-get update \
+	&& apt-get install -y --no-install-recommends \
+		python3 \
+		build-essential \
+		ca-certificates \
+		pkg-config \
+		file \
+	&& rm -rf /var/lib/apt/lists/*
+
+WORKDIR /build
+
+COPY ${LIBEVENT_TARBALL} /build/libevent.tar.gz
+COPY tests /build/tests
+COPY src /build/src
+COPY mk /build/mk
+COPY Makefile /build/Makefile
+
+RUN mkdir -p /build/libevent \
+	&& tar zxf /build/libevent.tar.gz -C /build/libevent --strip-components=1 \
+	&& find . \
+	&& make clean test LIBEVENT_SRC=./libevent \
+	&& make clean all LIBEVENT_SRC=./libevent
+
+FROM debian:trixie-slim AS runtime
+
+COPY --from=build /build/bin/tinyproxy /usr/local/bin/tinyproxy
+
+ENTRYPOINT ["/usr/local/bin/tinyproxy"]