added Dockerfile
This commit is contained in:
@@ -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+
|
||||
|
||||
Reference in New Issue
Block a user