├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── entrypoint.sh └── notifier.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # auto convert unless specified 2 | * text=auto 3 | 4 | # ctrl 5 | *.bat text eol=ctrl 6 | *.ps1 text eol=ctrl 7 | 8 | # lf 9 | *.sh text eol=lf 10 | *.py text eol=lf 11 | *.lua text eol=lf 12 | *.nix text eol=lf 13 | 14 | # binary (not text files) 15 | *.png binary 16 | *.jpg binary 17 | *.jpeg binary 18 | *.webp binary 19 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Publish image 2 | 3 | on: 4 | push: 5 | branches: master 6 | 7 | jobs: 8 | setup-build-push: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v3 13 | 14 | - name: Set up QEMU 15 | uses: docker/setup-qemu-action@v2 16 | 17 | - name: Set up Docker Buildx 18 | uses: docker/setup-buildx-action@v2 19 | 20 | - name: Login to Dockerhub 21 | run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin 22 | 23 | - name: Build the image 24 | run: | 25 | docker buildx create --name mainbuilder --driver docker-container --platform linux/amd64,linux/arm64 --use 26 | 27 | docker buildx build --push \ 28 | --tag passivelemon/zoraxy-docker:2.1.0 \ 29 | --platform linux/amd64,linux/arm64 \ 30 | --provenance=false \ 31 | . 32 | 33 | docker buildx build --push \ 34 | --tag passivelemon/zoraxy-docker:latest \ 35 | --platform linux/amd64,linux/arm64 \ 36 | --provenance=false \ 37 | . 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ContainerTester.sh 2 | ImagePublisher.sh 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/golang:1.21rc3-alpine3.18 2 | 3 | RUN apk add --no-cache bash curl jq git sudo 4 | 5 | RUN mkdir -p /zoraxy/source/ &&\ 6 | mkdir -p /zoraxy/config/ 7 | 8 | VOLUME [ "/zoraxy/config/" ] 9 | 10 | COPY entrypoint.sh /zoraxy/ 11 | COPY notifier.sh /zoraxy/ 12 | 13 | RUN chmod 755 /zoraxy/ &&\ 14 | chmod +x /zoraxy/entrypoint.sh 15 | 16 | ENV DOCKER="2.1.0" 17 | ENV NOTIFS="1" 18 | 19 | ENV VERSION="latest" 20 | ENV ARGS="-port=:8000 -noauth=false" 21 | 22 | ENTRYPOINT ["/zoraxy/entrypoint.sh"] 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 PassiveLemon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Docker container is no longer being updated in here. Check out the official GitHub Zoraxy repository [here](https://github.com/tobychui/zoraxy/) and the official Docker repository [here](https://hub.docker.com/r/zoraxydocker/zoraxy). 2 | 3 | 4 | 5 | # [zoraxy-docker](https://github.com/tobychui/zoraxy/)
6 | 7 | [![Repo](https://img.shields.io/badge/Docker-Repo-007EC6?labelColor-555555&color-007EC6&logo=docker&logoColor=fff&style=flat-square)](https://hub.docker.com/r/passivelemon/zoraxy-docker) 8 | [![Version](https://img.shields.io/docker/v/passivelemon/zoraxy-docker/latest?labelColor-555555&color-007EC6&style=flat-square)](https://hub.docker.com/r/passivelemon/zoraxy-docker) 9 | [![Size](https://img.shields.io/docker/image-size/passivelemon/zoraxy-docker/latest?sort=semver&labelColor-555555&color-007EC6&style=flat-square)](https://hub.docker.com/r/passivelemon/zoraxy-docker) 10 | [![Pulls](https://img.shields.io/docker/pulls/passivelemon/zoraxy-docker?labelColor-555555&color-007EC6&style=flat-square)](https://hub.docker.com/r/passivelemon/zoraxy-docker) 11 | 12 | ## Setup:
13 | Although not required, it is recommended to give Zoraxy a dedicated location on the host to mount the container. That way, the host/user can access them whenever needed. A volume will be created automatically within Docker if a location is not specified.
14 | 15 | You may also need to portforward your 80/443 to allow http and https traffic. If you are accessing the interface from outside of the local network, you may also need to forward your management port. If you know how to do this, great! If not, find the manufacturer of your router and search on how to do that. There are too many to be listed here.
16 | 17 | ### Using Docker run
18 | ``` 19 | docker run -d --name (container name) -p (ports) -v (path to storage directory):/zoraxy/data/ -e ARGS=(your arguments) -e VERSION=(version) passivelemon/zoraxy-docker:latest 20 | ``` 21 | 22 | ### Using Docker Compose
23 | ``` 24 | version: '3.3' 25 | services: 26 | zoraxy-docker: 27 | image: passivelemon/zoraxy-docker:latest 28 | container_name: (container name) 29 | ports: 30 | - 80:80 # Http port 31 | - 443:443 # Https port 32 | - (external):8000 # Management portal port 33 | volumes: 34 | - (path to storage directory):/zoraxy/config/ # Host directory for Zoraxy file storage 35 | environment: 36 | ARGS: '(your arguments)' # The arguments to run with Zoraxy. Enter them as they would be entered normally. 37 | VERSION: '(version in x.x.x)' # The release version of Zoraxy. 38 | ``` 39 | 40 | | Operator | Need | Details | 41 | |:-|:-|:-| 42 | | `-d` | Yes | will run the container in the background. | 43 | | `--name (container name)` | No | Sets the name of the container to the following word. You can change this to whatever you want. | 44 | | `-p (ports)` | Yes | Depending on how your network is setup, you may need to portforward 80, 443, and the management port. | 45 | | `-v (path to storage directory):/zoraxy/config/` | Recommend | Sets the folder that holds your files. This should be the place you just chose. By default, it will create a Docker volume for the files for persistency but they will not be accessible. | 46 | | `-e ARGS=(your arguments)` | No | Sets the arguments to run Zoraxy with. Enter them as you would normally. By default, it is ran with `-port=:8000 -noauth=false` | 47 | | `-e VERSION=(version)` | Recommended | Sets the version of Zoraxy that the container will download. Must be a supported release found on the Zoraxy GitHub. Make sure that it is not set to the containers version. Defaults to the latest if not set. | 48 | | `passivelemon/zoraxy-docker:latest` | Yes | The repository on Docker hub. By default, it is the latest version that I have published. | 49 | 50 | ## Examples:
51 | ### Docker Run
52 | ``` 53 | docker run -d --name zoraxy -p 80:80 -p 443:443 -p 8005:8000/tcp -v /home/docker/Containers/Zoraxy:/zoraxy/config/ -e ARGS="-port=:8000 -noauth=false" -e VERSION="2.6.5" passivelemon/zoraxy-docker:latest 54 | ``` 55 | 56 | ### Docker Compose
57 | ``` 58 | version: '3.3' 59 | services: 60 | zoraxy-docker: 61 | image: passivelemon/zoraxy-docker:latest 62 | container_name: zoraxy 63 | ports: 64 | - 80:80 65 | - 443:443 66 | - 8005:8000/tcp 67 | volumes: 68 | - /home/docker/Containers/Zoraxy:/zoraxy/config/ 69 | environment: 70 | ARGS: '-port=:8000 -noauth=false' 71 | VERSION: '2.6.5' 72 | ``` 73 |
74 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "|| Testing connectivity... ||" 4 | if ! curl -sSf https://www.github.com > /dev/null; then 5 | echo "|| GitHub could not be reached. Please check your internet connection and try again. ||" 6 | exit 7 | fi 8 | if [ "$(curl -s "https://api.github.com/repos/tobychui/zoraxy/git/refs/tags" | jq 'any(.[] | tostring; test("API rate limit exceeded"))')" = "true" ]; then 9 | echo "|| Currently rate limited by GitHub. Please wait until it clears. ||" 10 | exit 11 | fi 12 | 13 | # Container update notifier 14 | . /zoraxy/notifier.sh 15 | 16 | # Remove the V from the version if its present 17 | VERSION=$(echo "${VERSION}" | awk '{gsub(/^v/, ""); print}') 18 | 19 | # If version isn't valid, hard stop. 20 | function versionvalidate () { 21 | if [ -z $(curl -s "https://api.github.com/repos/tobychui/zoraxy/git/refs/tags" | jq -r ".[].ref | select(contains(\"${VERSION}\"))") ]; then 22 | echo "|| ${VERSION} is not a valid version. Please ensure it is set correctly. ||" 23 | exit 24 | fi 25 | } 26 | 27 | # Version setting 28 | if [ "${VERSION}" = "latest" ]; then 29 | # Latest release 30 | VERSION=$(curl -s https://api.github.com/repos/tobychui/zoraxy/releases | jq -r "[.[] | select(.tag_name)] | max_by(.created_at) | .tag_name") 31 | versionvalidate 32 | echo "|| Using Zoraxy version ${VERSION} (latest). ||" 33 | else 34 | versionvalidate 35 | echo "|| Using Zoraxy version ${VERSION}. ||" 36 | fi 37 | 38 | # Downloads & setup 39 | if [ ! -f "/zoraxy/server/zoraxy_bin_${VERSION}" ]; then 40 | echo "|| Cloning repository... ||" 41 | cd /zoraxy/source/ 42 | git clone --depth 1 --single-branch --branch ${VERSION} https://github.com/tobychui/zoraxy 43 | cd /zoraxy/source/zoraxy/src/ 44 | echo "|| Building... ||" 45 | go mod tidy 46 | go build 47 | mkdir -p /usr/local/bin/ 48 | mv /zoraxy/source/zoraxy/src/zoraxy /usr/local/bin/zoraxy_bin_${VERSION} 49 | chmod 755 /usr/local/bin/zoraxy_bin_${VERSION} 50 | echo "|| Finished. ||" 51 | fi 52 | 53 | # Starting 54 | cd /zoraxy/config/ 55 | zoraxy_bin_${VERSION} ${ARGS} 56 | -------------------------------------------------------------------------------- /notifier.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Container update notifier. Funny code do not go brrrrrrr 4 | UPDATE=$(curl -s https://api.github.com/repos/PassiveLemon/zoraxy-docker/releases | jq -r 'map(select(.prerelease = false)) | .[0].tag_name') 5 | UPDATE1=$(echo $UPDATE | awk -F. '{print $1}') 6 | UPDATE2=$(echo $UPDATE | awk -F. '{print $2}') 7 | UPDATE3=$(echo $UPDATE | awk -F. '{print $3}') 8 | 9 | DOCKER1=$(echo $DOCKER | awk -F. '{print $1}') 10 | DOCKER2=$(echo $DOCKER | awk -F. '{print $2}') 11 | DOCKER3=$(echo $DOCKER | awk -F. '{print $3}') 12 | 13 | NOTIFY=0 14 | 15 | if [ "${DOCKER1}" -lt "${UPDATE1}" ]; then 16 | NOTIFY=1 17 | fi 18 | if [ "${DOCKER1}" -le "${UPDATE1}" ] && [ "${DOCKER2}" -lt "${UPDATE2}" ]; then 19 | NOTIFY=1 20 | fi 21 | if [ "${DOCKER1}" -le "${UPDATE1}" ] && [ "${DOCKER2}" -le "${UPDATE2}" ] && [ "${DOCKER3}" -lt "${UPDATE3}" ]; then 22 | NOTIFY=1 23 | fi 24 | if [ "${NOTIFY}" = "1" ] && [ "${NOTIFS}" != "0" ]; then 25 | echo "|| Container update available. Current (${DOCKER}): New (${UPDATE}). ||" 26 | fi 27 | --------------------------------------------------------------------------------