From 597d6e28eca776bbc4530c24d1bc3e3da0adc2cb Mon Sep 17 00:00:00 2001 From: Paramtamtam <7326800+tarampampam@users.noreply.github.com> Date: Mon, 23 Jan 2023 00:24:45 +0400 Subject: [PATCH] feat: multiarch image (#31) --- .github/workflows/release.yml | 16 +++++++--------- .github/workflows/tests.yml | 35 ++--------------------------------- CHANGELOG.md | 12 ++++++++++++ Dockerfile | 21 +++++++++++++-------- README.md | 6 ++++-- 5 files changed, 38 insertions(+), 52 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 325306b..7c0d025 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,22 +9,20 @@ jobs: name: Build docker image runs-on: ubuntu-20.04 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - uses: gacts/github-slug@v1 - id: slug + - {uses: gacts/github-slug@v1, id: slug} + + - uses: docker/setup-qemu-action@v2 - uses: docker/setup-buildx-action@v2 - - name: Login to default Container Registry - uses: docker/login-action@v2 # Action page: + - uses: docker/login-action@v2 # Action page: with: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 # Action page: + - uses: docker/login-action@v2 # Action page: with: registry: ghcr.io username: ${{ github.actor }} @@ -33,8 +31,8 @@ jobs: - uses: docker/build-push-action@v3 # Action page: with: context: . - file: Dockerfile push: true + platforms: linux/amd64,linux/arm64,linux/ppc64le tags: | tarampampam/3proxy:${{ steps.slug.outputs.version-semantic }} tarampampam/3proxy:latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index defb7d2..400298d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,26 +18,17 @@ jobs: # Docs: - uses: actions/checkout@v3 with: {fetch-depth: 0} - - name: Check for GitLeaks - uses: gacts/gitleaks@v1 # Action page: + - uses: gacts/gitleaks@v1 build-image: name: Build docker image runs-on: ubuntu-20.04 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Build docker image run: docker build -f ./Dockerfile --tag 3proxy:local . - - name: Scan image - uses: anchore/scan-action@v3 # action page: - with: - image: 3proxy:local - fail-build: true - severity-cutoff: low # negligible, low, medium, high or critical - - name: Save docker image run: docker save 3proxy:local > ./docker-image.tar @@ -48,28 +39,6 @@ jobs: # Docs: path: ./docker-image.tar retention-days: 1 - scan-image: - name: Scan docker image - runs-on: ubuntu-20.04 - needs: [build-image] - steps: - - name: Download built docker image - uses: actions/download-artifact@v3 - with: - name: docker-image - path: .artifact - - - name: Prepare image to run - working-directory: .artifact - run: docker load < docker-image.tar - - - name: Scan image - uses: anchore/scan-action@v3 # action page: - with: - image: 3proxy:local - fail-build: true - severity-cutoff: low # negligible, low, medium, high or critical - try-to-use: name: Build and use docker image (auth ${{ matrix.auth }}) runs-on: ubuntu-20.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c084c1..6c85730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver]. +## v1.8.1 + +### Added + +- Multi-arch image support (plus `arm64` and `ppc64le`) [#31] + +### Fixed + +- Error page colors now depend on the theme, and the text is centered [#31] + +[#31]:https://github.com/tarampampam/3proxy-docker/pull/31 + ## v1.8.0 ### Added diff --git a/Dockerfile b/Dockerfile index fc22573..14e6be6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,12 @@ WORKDIR /tmp/3proxy RUN set -x \ && echo '#define ANONYMOUS 1' >> ./src/3proxy.h \ # proxy.c source: - && sed -i 's~\(<\/head>\)~\1~' ./src/proxy.c \ + && sed -i 's~\(<\/head>\)~\1~' ./src/proxy.c \ && cat ./src/proxy.c | grep '' # And compile @@ -34,7 +36,7 @@ RUN set -x \ && strip ./bin/SSLPlugin.ld.so # Prepare filesystem for 3proxy running -FROM busybox:stable-glibc as buffer +FROM alpine:latest as buffer # create a directory for the future root filesystem WORKDIR /tmp/rootfs @@ -44,10 +46,13 @@ RUN set -x \ && mkdir -p ./etc ./bin ./usr/local/3proxy/libexec ./etc/3proxy \ && echo '3proxy:x:10001:10001::/nonexistent:/sbin/nologin' > ./etc/passwd \ && echo '3proxy:x:10001:' > ./etc/group \ - && wget -O ./bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64" \ - && chmod +x ./bin/dumb-init + && apk add --no-cache --virtual .build-deps curl ca-certificates \ + && update-ca-certificates \ + && curl -SsL -o ./bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_$(arch)" \ + && chmod +x ./bin/dumb-init \ + && apk del .build-deps -COPY --from=builder /lib/x86_64-linux-gnu/libdl.so.* ./lib/ +COPY --from=builder /lib/*-linux-gnu/libdl.so.* ./lib/ COPY --from=builder /tmp/3proxy/bin/3proxy ./bin/3proxy COPY --from=builder /tmp/3proxy/bin/*.ld.so ./usr/local/3proxy/libexec/ COPY --from=ghcr.io/tarampampam/mustpl:0.1.0 /bin/mustpl ./bin/mustpl diff --git a/README.md b/README.md index 033460f..ff2d8dd 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ TCP ports: All supported image tags [can be found here][link_docker_tags]. +> Since v1.8.1 architectures `arm64` and `ppc64le` (and `amd64` of course) are supported. + ## Supported environment variables | Variable name | Description | Example | @@ -53,7 +55,7 @@ For example: $ docker run --rm -d \ -p "3128:3128/tcp" \ -p "1080:1080/tcp" \ - tarampampam/3proxy:latest + ghcr.io/tarampampam/3proxy:latest ``` Or with auth & resolver settings: @@ -65,7 +67,7 @@ $ docker run --rm -d \ -e "PROXY_LOGIN=evil" \ -e "PROXY_PASSWORD=live" \ -e "PRIMARY_RESOLVER=2001:4860:4860::8888" \ - tarampampam/3proxy:latest + ghcr.io/tarampampam/3proxy:latest ``` ## Releasing