From 04fb12076c80bae0e0e1570f2db102c960057e02 Mon Sep 17 00:00:00 2001 From: Paramtamtam Date: Sat, 11 Jul 2020 11:49:43 +0500 Subject: [PATCH] v1.0.0 --- .github/workflows/release.yml | 7 +++++- 3proxy.cfg | 29 +++++++++++++++++++++++++ CHANGELOG.md | 6 +++++ Dockerfile | 10 ++++----- README.md | 4 ++-- docker-entrypoint.sh | 41 +---------------------------------- 6 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 3proxy.cfg diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8b9ffe..a8ae272 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,12 @@ jobs: run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin &> /dev/null - name: Build image - run: docker build --tag "tarampampam/3proxy:${IMAGE_TAG}" --tag "tarampampam/3proxy:latest" -f ./Dockerfile . + run: | + docker build \ + --build-arg "BUILD_DATE=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" \ + --tag "tarampampam/3proxy:${IMAGE_TAG}" \ + --tag "tarampampam/3proxy:latest" \ + -f ./Dockerfile . - name: Push version image run: docker push "tarampampam/3proxy:${IMAGE_TAG}" diff --git a/3proxy.cfg b/3proxy.cfg new file mode 100644 index 0000000..f932781 --- /dev/null +++ b/3proxy.cfg @@ -0,0 +1,29 @@ +#!/usr/bin/3proxy +config /etc/3proxy/3proxy.cfg + +# you may use system to execute some external command if proxy starts +system "echo `which 3proxy`': Starting 3proxy'" + +# We can configure nservers to avoid unsafe gethostbyname() usage +nserver 1.0.0.1 +nserver 1.1.1.1 +nserver 8.8.4.4 +nserver 8.8.8.8 + +# nscache is good to save speed, traffic and bandwidth +nscache 65536 + +# Here we can change timeout values +timeouts 1 5 30 60 180 1800 15 60 + +log /dev/stdout +logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T" + +maxconn 1024 + +#AUTH_SETTINGS + +proxy -a -p3128 +socks -a -p1080 + +flush diff --git a/CHANGELOG.md b/CHANGELOG.md index e272484..f2ae027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ 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.0.0 + +### Fixed + +- Dockerfile and docker entry-point script cleanup + ## v0.1.1 ### Fixed diff --git a/Dockerfile b/Dockerfile index ab655f8..0348ff7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,9 @@ ARG VERSION="0.8.13" RUN set -x \ && apk add --no-cache \ - ca-certificates \ linux-headers \ build-base \ git \ - && update-ca-certificates \ && git clone --branch ${VERSION} https://github.com/z3APA3A/3proxy.git /tmp/3proxy \ && cd /tmp/3proxy \ && echo '#define ANONYMOUS 1' >> /tmp/3proxy/src/3proxy.h \ @@ -18,6 +16,9 @@ RUN set -x \ FROM alpine:latest +# e.g.: `docker build --build-arg "BUILD_DATE=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" .` +ARG BUILD_DATE + LABEL \ org.label-schema.name="3proxy" \ org.label-schema.description="Tiny free proxy server" \ @@ -25,13 +26,13 @@ LABEL \ org.label-schema.vcs-url="https://github.com/tarampampam/3proxy-docker" \ org.label-schema.docker.cmd="docker run --rm -d -p \"3128:3128/tcp\" -p \"1080:1080/tcp\" this_image" \ org.label-schema.vendor="tarampampam" \ + org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.license="WTFPL" \ org.label-schema.schema-version="1.0" +COPY 3proxy.cfg /etc/3proxy/3proxy.cfg COPY docker-entrypoint.sh /docker-entrypoint.sh -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /tmp/3proxy/src/3proxy /usr/bin/3proxy -COPY --from=builder /tmp/3proxy/cfg/3proxy.cfg.sample /etc/3proxy/3proxy.cfg RUN set -x \ # Unprivileged user creation @@ -43,7 +44,6 @@ RUN set -x \ --no-create-home \ --uid 10001 \ 3proxy \ - && touch /etc/3proxy/passwd \ && chown 3proxy:3proxy -R /etc/3proxy # Use an unprivileged user diff --git a/README.md b/README.md index 000de82..efeb7e8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Why this image created? -3proxy is awesome and lightweight proxy-server. This image contains stable version with it and can be configured using environment variables. +3proxy is awesome and lightweight proxy-server. This image contains stable version with it and can be configured using environment variables. By default, it uses anonymous (hide information about client) proxy settings. > Page on `hub.docker.com` can be [found here][link_docker_hub]. @@ -79,7 +79,7 @@ If you will find any package errors, please, [make an issue][link_create_issue] WTFPL. Use anywhere for your pleasure. [badge_build_status]:https://img.shields.io/github/workflow/status/tarampampam/3proxy-docker/tests/master?logo=github&label=build -[badge_release_status]:https://img.shields.io/github/workflow/status/tarampampam/3proxy-docker/release/master?logo=github&label=release +[badge_release_status]:https://img.shields.io/github/workflow/status/tarampampam/3proxy-docker/release?logo=github&label=release [badge_release_date]:https://img.shields.io/github/release-date/tarampampam/3proxy-docker.svg?style=flat-square&maxAge=180 [badge_commits_since_release]:https://img.shields.io/github/commits-since/tarampampam/3proxy-docker/latest.svg?style=flat-square&maxAge=180 [badge_issues]:https://img.shields.io/github/issues/tarampampam/3proxy-docker.svg?style=flat-square&maxAge=180 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fd7752e..05da869 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -15,46 +15,7 @@ if [ "$AUTH_REQUIRED" = "true" ]; then fi; echo "$0: setup '${PROXY_LOGIN}:${PROXY_PASSWORD}' as proxy user"; - echo "${PROXY_LOGIN}:CL:${PROXY_PASSWORD}" > /etc/3proxy/passwd -fi; - -echo "$0: rewrite configuration file"; -cat << \EOF > /etc/3proxy/3proxy.cfg -#!/usr/bin/3proxy -config /etc/3proxy/3proxy.cfg - -# you may use system to execute some external command if proxy starts -system "echo `which 3proxy`': Starting 3proxy'" - -# We can configure nservers to avoid unsafe gethostbyname() usage -nserver 1.0.0.1 -nserver 1.1.1.1 -nserver 8.8.4.4 -nserver 8.8.8.8 - -# nscache is good to save speed, traffic and bandwidth -nscache 65536 - -# Here we can change timeout values -timeouts 1 5 30 60 180 1800 15 60 - -log /dev/stdout -logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T" - -maxconn 1024 - -#AUTH_SETTINGS - -proxy -a -p3128 -socks -a -p1080 - -flush -EOF - -if [ "$AUTH_REQUIRED" = "true" ]; then - echo "$0: setup auth settings in configuration file"; - - sed -i "s~#AUTH_SETTINGS~users \$/etc/3proxy/passwd\nauth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg + sed -i "s~#AUTH_SETTINGS~users ${PROXY_LOGIN}:CL:${PROXY_PASSWORD}\nauth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg fi; exec "$@"