Added docker functionality.

This commit is contained in:
Aodhan
2025-06-25 22:26:49 +01:00
parent c5391a957d
commit 7bebc95c09
8 changed files with 126 additions and 11 deletions

View File

@@ -56,3 +56,36 @@ This will reset and recalculate all `nsfw` flags so that the new filters work co
- Python 3.x
- Standard Python libraries (http.server, sqlite3, etc.)
- Web browser with JavaScript enabled
## Docker
If you have Docker installed you can build and run the application in an isolated container:
```bash
# Build image (only once)
docker build -t swiper-app .
# Run the container on port 8888
docker run --rm -p 8888:8888 swiper-app
```
Then open [http://localhost:8888](http://localhost:8888) in your browser.
The Dockerfile uses a minimal Python 3.11 image, installs the Python dependencies from `requirements.txt`, exposes port 8888 and starts the app with `python server.py`.
### Docker Compose
A `docker-compose.yml` file is included so you can run the container with your image folders mounted automatically.
```bash
# Build image (first time or when code changes)
docker compose up --build
```
This will:
- Publish port **8888** on your host → container.
- Mount the portrait and landscape image folders (update paths in `docker-compose.yml` as needed) read-only into `/media/Portrait` and `/media/Landscape` inside the container.
- Set `IMAGE_DIRS=/media/Portrait:/media/Landscape` so the server finds the images.
Adjust ports, folders or environment variables by editing `docker-compose.yml`. Remember to rebuild (`docker compose up --build`) after changes.