Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paramtamtam committed Jul 11, 2020
1 parent 6d94db1 commit 04fb120
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 48 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
29 changes: 29 additions & 0 deletions 3proxy.cfg
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@ 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 \
&& make -f Makefile.Linux

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" \
org.label-schema.url="https://github.com/tarampampam/3proxy-docker" \
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 <https://stackoverflow.com/a/55757473/12429735RUN>
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down Expand Up @@ -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
Expand Down
41 changes: 1 addition & 40 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit 04fb120

Please sign in to comment.