Added docker file (Fork from PassiveLemon)

This commit is contained in:
Toby Chui 2023-06-21 19:45:58 +08:00
parent 828af6263d
commit 3fbf246fb4
4 changed files with 126 additions and 0 deletions

17
docker/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM alpine:latest
RUN apk update && apk upgrade &&\
apk add bash curl jq &&\
mkdir -p /zoraxy/data/
VOLUME [ "/zoraxy/data/" ]
COPY entrypoint.sh /zoraxy/
RUN chmod +x /zoraxy/entrypoint.sh
ENV ARGS="-port=:8000 -noauth=false"
EXPOSE 8000
ENTRYPOINT ["/zoraxy/entrypoint.sh"]

21
docker/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 PassiveLemon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

68
docker/README.md Normal file
View File

@ -0,0 +1,68 @@
# zoraxy-docker </br>
[![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)
[![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)
[![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)
[![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)
Docker container for [Zoraxy](https://github.com/tobychui/zoraxy) </br>
## Setup: </br>
There really isn't much here, just make sure you find a good place to store the files on your host. The container will download everything automatically so this place is used to store the files so they aren't deleted when the container is deleted. </br>
### Using Docker run </br>
```
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
```
### Using Docker Compose </br>
```
version: '3.3'
services:
zoraxy-docker:
image: passivelemon/zoraxy-docker:latest
container_name: (container name)
ports:
- 80:80 # Http port
- 443:443 # Https port
- (wanted port):8000 # Management portal port
volumes:
- (path to storage directory):/zoraxy/data/ # Host directory for Zoraxy file storage
environment:
ARGS: '-port=:8000' # Telling Zoraxy what port to listen on for the management portal. Changing this means building the image yourself with your own exposed port. Might change in the future.
```
| Operator | Need | Details |
|:-|:-|:-|
| `-d` | Yes | will run the container in the background. |
| `--name (container name)` | No | Sets the name of the container to the following word. You can change this to whatever you want. |
| `-v (path to storage directory):/zoraxy/data/` | 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. |
| `-e ARGS=(your arguments)` | No | Sets the arguments to run Zoraxy with. By default, it is ran with `-port=:8000 -noauth=false` |
| `-e VERSION=(version)` | No | Sets the version of Zoraxy that the container will download. Must be a supported version found on the Zoraxy Github. Defaults to the latest if not set. |
| `passivelemon/zoraxy-docker:latest` | Yes | The repository on Docker hub. By default, it is the latest version that I have published. |
## Examples: </br>
### Docker Run </br>
```
docker run -d --name zoraxy -p 8000:8000/tcp -v /home/docker/Containers/Zoraxy:/zoraxy/data/ -e ARGS="-port=:8000 -noauth=false" passivelemon/zoraxy-docker:latest
```
### Docker Compose </br>
```
version: '3.3'
services:
zoraxy-docker:
image: passivelemon/zoraxy-docker:latest
container_name: zoraxy
ports:
- 80:80
- 443:443
- 8000:8000
volumes:
- /home/docker/Containers/Zoraxy:/zoraxy/data/
environment:
ARGS: '-port=:8000'
```
### Other </br>
If the container doesn't start properly, you might be rate limited from GitHub for some amount of time. You can check this by running `curl -s https://api.github.com/repos/tobychui/zoraxy/releases` on the host. If you are, you will just have to wait for a little while or use a VPN. </br>

20
docker/entrypoint.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
cd /zoraxy/data/
if [ "$VERSION" != "" ]; then
echo "|| Using release ${VERSION} ||"
release=${VERSION}
else
echo "|| Using latest release ||"
# Gets the latest pre-release version tag.
release=$(curl -s https://api.github.com/repos/tobychui/zoraxy/releases | jq -r 'map(select(.prerelease)) | .[0].tag_name')
fi
if [ ! -e /zoraxy/data/zoraxy_linux_amd64 ]; then
echo "|| Downloading version ${release} ||"
curl -sL --output /zoraxy/data/zoraxy_linux_amd64 https://github.com/tobychui/zoraxy/releases/download/${release}/zoraxy_linux_amd64
chmod u+x /zoraxy/data/zoraxy_linux_amd64
fi
./zoraxy_linux_amd64 ${ARGS}