added Dockerfile

This commit is contained in:
Florian Walther
2026-05-01 18:46:12 +02:00
parent 27927f45be
commit e03a674222
3 changed files with 98 additions and 0 deletions
+53
View File
@@ -117,6 +117,59 @@ The creation timestamp is stored in the file's `CreatedAt` field and persists ac
| GET | `/logout` | Clear session |
| GET | `/claim` | Claim anonymous files (auto-handled in register) |
## Docker
### Build the Image
```bash
docker build -t mdhost .
```
### Run with Docker
The `data` and `posts` directories are designed to be bind-mounted from the host filesystem for persistence:
```bash
# Create host directories for persistent data
mkdir -p ~/mdhost-data ~/mdhost-posts
# Run the container with bind mounts
docker run -d \
--name mdhost \
-p 8080:8080 \
-v ~/mdhost-posts:/posts \
-v ~/mdhost-data:/data \
mdhost
```
The application will be available at `http://localhost:8080`.
- **`/posts`** - Markdown files are stored here (bind-mounted from host)
- **`/data`** - Metadata (users, sessions, file metadata) is stored here as `data.json` (bind-mounted from host)
### Docker Compose
Create a `docker-compose.yml`:
```yaml
version: '3.8'
services:
mdhost:
build: .
ports:
- "8080:8080"
volumes:
- ./posts:/posts
- ./data:/data
restart: unless-stopped
```
Then run:
```bash
docker compose up -d
```
## Dependencies
- Go 1.26+