Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Dockerfile and how to use with docker to README.md #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down