summaryrefslogtreecommitdiff
path: root/CONTAINER.md
blob: b87d65d92ee78712ded07c44c9700d296e0afbfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# FCTDrive Container Deployment

This document explains how to build and run the FCTDrive application as a container.

## Prerequisites

1. **Build the binaries locally first:**
   ```bash
   # Build the Rust CLI tool
   just build  # or: cargo build --release --target-dir target/
   
   # Build the frontend (optional, done in container)
   cd frontend && npm run build
   ```

2. **Container runtime** (podman, docker, etc.)

## Building the Container

```bash
# Build the container image
podman build -t fctdrive:latest .

# Or with docker
docker build -t fctdrive:latest .
```

## Running the Container

```bash
# Run with volumes for persistent data
podman run -d \
  --name fctdrive \
  -p 3000:3000 \
  -v ./blobs:/app/blobs:Z \
  -v ./data:/app/data:Z \
  -e TINYAUTH_ENDPOINT=http://localhost:3001 \
  -e TINYAUTH_PUBLIC_ENDPOINT=http://localhost:3001 \
  -e FCTDRIVE_PATH=/app/data \
  fctdrive:latest
```

## Environment Variables

- `TINYAUTH_ENDPOINT` - Internal TinyAuth server URL
- `TINYAUTH_PUBLIC_ENDPOINT` - Public TinyAuth server URL (for browser redirects)
- `FCTDRIVE_PATH` - Path to the drive data directory
- `NODE_ENV=production` (set automatically)
- `HOSTNAME=0.0.0.0` (set automatically)

## Volume Mounts

- `/app/blobs` - Blob storage directory
- `/app/data` - Drive metadata/database directory

## Container Features

- **Base image**: Fedora 42
- **Runtime**: Node.js + npm
- **Binary**: Pre-built `fctdrive` binary in PATH
- **User**: Non-root user `fctdrive`
- **Port**: 3000 (Next.js server)
- **Build**: Production Next.js build

## Security

- Runs as non-root user (`fctdrive:fctdrive`)
- Only production dependencies installed
- Minimal attack surface with focused .containerignore

## Development vs Production

This container is designed for production deployment. For development:
- Use `just dev` for hot-reloading
- Mount source code as volumes
- Use development dependencies