From 892161bab0e52f6e6fe97aa6da8395a5ea6f6209 Mon Sep 17 00:00:00 2001 From: iluvatyr Date: Sat, 8 Apr 2023 20:49:20 +0200 Subject: [PATCH] Adding Dockerfile and how to use with docker to README.md --- Dockerfile | 13 +++++++++++++ README.md | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b30692e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM lscr.io/linuxserver/nginx:latest + +ENV URL your-ipmagnet-url-or-IP-without-trailing-slash.com +ENV ENABLE_INTERVAL true +ENV INTERVAL 60 + +RUN apk add --update --upgrade --no-cache git + +RUN git clone https://github.com/cbdevnet/ipmagnet.git /config/www +RUN sed -i "s|http://localhost:80/ipmagnet/|$URL/|g" /config/www/index.php +RUN sed -i "s|$trackerInterval=300;|$trackerInterval=$INTERVAL;|g" /config/www/index.php +RUN sed -i "s|$enableInterval=false;|$trackerInterval=$ENABLE_INTERVAL;|g" /config/www/index.php +RUN chown -R 911:911 /config/www diff --git a/README.md b/README.md index 1c46940..e1bccab 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,29 @@ facilitate further tracking. * SQLite PDO modules for the PHP installation (eg. php7.0-sqlite3 on Debian) * The user running the HTTP daemon (www-data on debian) must have read/write access on the database file as well as the folder containing it -## Setup +## Setup with Docker + +You can easily build your own ipmagnet docker container by following the instructions below. + +1. Clone this repository, then edit the environment variables within the Dockerfile provided according to your configuration or just create a file named "Dockerfile" yourself and copy inside the content of the Dockerfile, while changing the ENV variables according to your configuration. + +Variable | type | unit | example +------------- | ------------- | ------------- | ------------- +URL | String | - | your-ipmagnet-url-or-IP-without-trailing-slash.com or 127.0.0.1 or 196.23.62.266 +ENABLE_INTERVAL | boolean | - | true +INTERVAL | integer | seconds | 60 + +2. Build the container with the `docker build -t "ipmagnet" . ` from the same folder the Dockerfile resides in. + +This will create a nginx webserver and use the files from the ipmagnet repository. + +3. Run the ipmagnet container by using `docker run -d --rm --name ipmagnet -p 80:80 ipmagnet` + +You can of course change the port binding aswell, e.g. `docker run -d --rm --name ipmagnet -p 443:443 ipmagnet` or `docker run -d --rm --name ipmagnet -p 8080:80 ipmagnet` + +4. You can then access the webui with the defined URL you set within the "URL" environment variable of the Dockerfile and the port used. Usually it would be `127.0.0.1:80` or the public IP of the server where it is hosted. + +## Setup without Docker 1. Clone the repo into a folder that is available by the http daemon. 2. Edit index.php