feat: Add Dockerfile

This commit is contained in:
gd 2022-01-05 13:12:51 +03:00
parent 312efc9047
commit dd570f7f93
2 changed files with 46 additions and 1 deletions

7
Dockerfile Normal file
View File

@ -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

View File

@ -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.