Basic repository files added
This commit is contained in:
commit
9577d9c925
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{yml, yaml, sh, conf}]
|
||||
indent_size = 2
|
28
.github/workflows/release.yml
vendored
Normal file
28
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
release: # Docs: <https://git.io/JeBz1#release-event-release>
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
docker-image:
|
||||
name: Build docker image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Generate image tag value
|
||||
run: echo "::set-env name=IMAGE_TAG::${GITHUB_REF##*/[vV]}" # `/refs/tags/v1.2.3` -> `1.2.3`
|
||||
|
||||
- name: Make docker login
|
||||
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 .
|
||||
|
||||
- name: Push version image
|
||||
run: docker push "tarampampam/3proxy:${IMAGE_TAG}"
|
||||
|
||||
- name: Push latest image
|
||||
run: docker push "tarampampam/3proxy:latest"
|
52
.github/workflows/tests.yml
vendored
Normal file
52
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags-ignore:
|
||||
- '**'
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # once in a week, docs: <https://git.io/JvxXE#onschedule>
|
||||
|
||||
jobs: # Docs: <https://git.io/JvxXE>
|
||||
docker-image:
|
||||
name: Build and use docker image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build docker image
|
||||
run: docker build -f ./Dockerfile --tag image:local .
|
||||
|
||||
- name: Run docker image with default settings
|
||||
run: docker run --rm -d -p "3128:3128/tcp" -p "1080:1080/tcp" image:local
|
||||
|
||||
- name: Pause
|
||||
run: sleep 2
|
||||
|
||||
- name: Try to use HTTP proxy
|
||||
run: curl -v --fail --proxy http://127.0.0.1:3128 --connect-timeout 3 --max-time 3 https://github.com/robots.txt
|
||||
|
||||
- name: Try to use SOCKS proxy
|
||||
run: curl -v --fail --proxy socks5://127.0.0.1:1080 --connect-timeout 3 --max-time 3 https://github.com/robots.txt
|
||||
|
||||
- name: Stop container
|
||||
run: docker stop $(docker ps -a --filter ancestor=image:local -q)
|
||||
|
||||
- name: Run docker image with auth settings
|
||||
run: docker run --rm -d -p "3128:3128/tcp" -p "1080:1080/tcp" -e "AUTH_REQUIRED=true" -e "PROXY_LOGIN=evil" -e "PROXY_PASSWORD=live" image:local
|
||||
|
||||
- name: Pause
|
||||
run: sleep 2
|
||||
|
||||
- name: Try to use HTTP proxy
|
||||
run: curl -v --fail --proxy http://127.0.0.1:3128 --proxy-user evil:live --connect-timeout 3 --max-time 3 https://github.com/robots.txt
|
||||
|
||||
- name: Try to use SOCKS proxy
|
||||
run: curl -v --fail --proxy socks5://127.0.0.1:1080 --proxy-user evil:live --connect-timeout 3 --max-time 3 https://github.com/robots.txt
|
||||
|
||||
- name: Stop container
|
||||
run: docker stop $(docker ps -a --filter ancestor=image:local -q)
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
## IDEs
|
||||
/.vscode
|
||||
/.idea
|
14
CHANGELOG.md
Normal file
14
CHANGELOG.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
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].
|
||||
|
||||
## v0.1.0
|
||||
|
||||
### Changed
|
||||
|
||||
- First project release
|
||||
|
||||
[keepachangelog]:https://keepachangelog.com/en/1.0.0/
|
||||
[semver]:https://semver.org/spec/v2.0.0.html
|
54
Dockerfile
Normal file
54
Dockerfile
Normal file
@ -0,0 +1,54 @@
|
||||
# Image page: <https://hub.docker.com/_/alpine>
|
||||
FROM alpine:latest as builder
|
||||
|
||||
# e.g.: `docker build --build-arg "VERSION=0.8.13" .`
|
||||
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
|
||||
|
||||
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.license="WTFPL" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
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>
|
||||
&& adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home /nonexistent \
|
||||
--shell /sbin/nologin \
|
||||
--no-create-home \
|
||||
--uid 10001 \
|
||||
3proxy \
|
||||
&& touch /etc/3proxy/passwd \
|
||||
&& chown 3proxy:3proxy -R /etc/3proxy
|
||||
|
||||
# Use an unprivileged user
|
||||
USER 3proxy:3proxy
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/bin/3proxy", "/etc/3proxy/3proxy.cfg"]
|
9
LICENSE
Normal file
9
LICENSE
Normal file
@ -0,0 +1,9 @@
|
||||
Copyright (C) tarampampam <github.com/tarampampam>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified copies of this license
|
||||
document, and changing it is allowed as long as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING,
|
||||
DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
93
README.md
Normal file
93
README.md
Normal file
@ -0,0 +1,93 @@
|
||||
<p align="center">
|
||||
<img src="https://hsto.org/webt/kp/e1/ud/kpe1udvcjss_-wtmrws-w9radke.png" width="96" alt="" />
|
||||
</p>
|
||||
|
||||
# Docker image with [3proxy][link_3proxy]
|
||||
|
||||
[![Build Status][badge_build_status]][link_build_status]
|
||||
[![Release Status][badge_release_status]][link_build_status]
|
||||
[![Image size][badge_size_latest]][link_docker_hub]
|
||||
[![Docker Pulls][badge_docker_pulls]][link_docker_hub]
|
||||
[![License][badge_license]][link_license]
|
||||
|
||||
## 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.
|
||||
|
||||
> Page on `hub.docker.com` can be [found here][link_docker_hub].
|
||||
|
||||
## Supported tags
|
||||
|
||||
[][link_docker_tags]
|
||||
|
||||
All supported image tags [can be found here][link_docker_tags].
|
||||
|
||||
## Supported environment variables
|
||||
|
||||
Variable name | Description | Example
|
||||
---------------- | ----------------------------------------- | ---------------
|
||||
`AUTH_REQUIRED` | Require authorization? (default: `false`) | `true`, `false`
|
||||
`PROXY_LOGIN` | Authorization login | `username`
|
||||
`PROXY_PASSWORD` | Authorization password | `password`
|
||||
|
||||
## How can I use this?
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
$ docker run --rm -d \
|
||||
-p "3128:3128/tcp" \
|
||||
-p "1080:1080/tcp" \
|
||||
tarampampam/3proxy:latest
|
||||
```
|
||||
|
||||
Or with auth settings:
|
||||
|
||||
```bash
|
||||
$ docker run --rm -d \
|
||||
-e "AUTH_REQUIRED=true" \
|
||||
-e "PROXY_LOGIN=evil" \
|
||||
-e "PROXY_PASSWORD=live" \
|
||||
-p "3128:3128/tcp" \
|
||||
-p "1080:1080/tcp" \
|
||||
tarampampam/3proxy:latest
|
||||
```
|
||||
|
||||
## Changes log
|
||||
|
||||
[![Release date][badge_release_date]][link_releases]
|
||||
[![Commits since latest release][badge_commits_since_release]][link_commits]
|
||||
|
||||
Changes log can be [found here][link_changes_log].
|
||||
|
||||
## Support
|
||||
|
||||
[![Issues][badge_issues]][link_issues]
|
||||
[![Issues][badge_pulls]][link_pulls]
|
||||
|
||||
If you will find any package errors, please, [make an issue][link_create_issue] in current repository.
|
||||
|
||||
## License
|
||||
|
||||
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_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
|
||||
[badge_pulls]:https://img.shields.io/github/issues-pr/tarampampam/3proxy-docker.svg?style=flat-square&maxAge=180
|
||||
[badge_license]:https://img.shields.io/github/license/tarampampam/3proxy-docker.svg?longCache=true
|
||||
[badge_size_latest]:https://img.shields.io/docker/image-size/tarampampam/3proxy/latest?maxAge=30
|
||||
[badge_docker_pulls]:https://img.shields.io/docker/pulls/tarampampam/3proxy.svg
|
||||
[link_releases]:https://github.com/tarampampam/3proxy-docker/releases
|
||||
[link_commits]:https://github.com/tarampampam/3proxy-docker/commits
|
||||
[link_changes_log]:https://github.com/tarampampam/3proxy-docker/blob/master/CHANGELOG.md
|
||||
[link_issues]:https://github.com/tarampampam/3proxy-docker/issues
|
||||
[link_pulls]:https://github.com/tarampampam/3proxy-docker/pulls
|
||||
[link_build_status]:https://travis-ci.org/tarampampam/3proxy-docker
|
||||
[link_create_issue]:https://github.com/tarampampam/3proxy-docker/issues/new
|
||||
[link_license]:https://github.com/tarampampam/3proxy-docker/blob/master/LICENSE
|
||||
[link_docker_tags]:https://hub.docker.com/r/tarampampam/3proxy/tags
|
||||
[link_docker_hub]:https://hub.docker.com/r/tarampampam/3proxy/
|
||||
[link_3proxy]:https://github.com/z3APA3A/3proxy
|
63
docker-entrypoint.sh
Executable file
63
docker-entrypoint.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
AUTH_REQUIRED=${AUTH_REQUIRED:-false} # true|false
|
||||
PROXY_LOGIN=${PROXY_LOGIN:-} # string
|
||||
PROXY_PASSWORD=${PROXY_PASSWORD:-} # string
|
||||
|
||||
if [ "$AUTH_REQUIRED" = "true" ]; then
|
||||
if [ -z "$PROXY_LOGIN" ]; then
|
||||
(>&2 echo "$0: environment variable 'PROXY_LOGIN' is not specified!"); exit 1;
|
||||
fi;
|
||||
|
||||
if [ -z "$PROXY_PASSWORD" ]; then
|
||||
(>&2 echo "$0: environment variable 'PROXY_PASSWORD' is not specified!"); exit 1;
|
||||
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
|
||||
|
||||
# Include passwd file. For included files <CR> and <LF> are treated as field separators
|
||||
users $/etc/3proxy/passwd
|
||||
|
||||
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~auth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg
|
||||
fi;
|
||||
|
||||
exec "$@"
|
Loading…
x
Reference in New Issue
Block a user