diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55a26d4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:latest +ADD . /opt/imgs +RUN mkdir -p /opt/imgs/uploads +WORKDIR /opt/imgs +RUN pip install --upgrade pip && pip install --requirement requirements.txt +EXPOSE 5000 +CMD gunicorn imgs:app --bind :5000 diff --git a/README.md b/README.md index 5a34a1d..81a9d14 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,50 @@ imgs is a minimalictic image sharing web app written with Bottle framework. No database. No image compression. No time limits. No additional dependencies. Features: + * Upload images via Drag&Drop * Easy copy share link * MIME type detecting See deployment options in Bottle documentation: https://bottlepy.org/docs/dev/deployment.html +# Run imgs in Docker + +Clone repository and edit **imgs.ini**. + +Build Docker image: + +```bash +docker build --tag imgs . +``` + +Run container from image. Replace **/path/to/your/uploads/dir** with path to directory where you want to store images: + +``` +sudo docker run --rm --name imgs --detach --publish 127.0.0.1:5000:5000 --volume /path/to/your/uploads/dir:/opt/imgs/uploads imgs +``` + +imgs will launched on `127.0.0.1:5000`. Set up reverse proxy server. I recommed to use basic authentication to prevent abuses. Nginx virtual host example: + +```nginx +server { + listen 80; + server_name yourdomain.tld; + + location / { + root /path/to/imgs/root; + auth_basic "Authentication required"; + auth_basic_user_file /path/to/.htpasswd; + proxy_pass http://127.0.0.1:5000; + } + + location ~* \..* { + auth_basic off; + proxy_pass http://127.0.0.1:5000; + } +} +``` + # Additional ## imgs client with CLI @@ -25,4 +63,4 @@ sudo cp imgs /usr/bin/imgs Push files to your imgs instance via GNOME Files (former name: Nautilus). Depends packages: curl, notyfy-send. -Just place **Upload to imgs** script into **~/.local/share/nautilus/scripts**. +Just place **Upload to imgs** script into **~/.local/share/nautilus/scripts/** directory.