diff options
| author | diogo464 <[email protected]> | 2025-08-14 14:46:47 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-14 14:46:47 +0100 |
| commit | 5c32d58bbeb6d0cc836a78a2279bb88ffc8fba63 (patch) | |
| tree | 225395773dc1573fc5148a6795a80f0f22007568 /CONTAINER.md | |
| parent | cf290372162b918c56d2c2e5ba67d7f448ad19ba (diff) | |
add: container configuration files
- .containerignore: exclude unnecessary files from container builds
- CONTAINER.md: documentation for container deployment
- Containerfile: multi-stage build configuration for production
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'CONTAINER.md')
| -rw-r--r-- | CONTAINER.md | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/CONTAINER.md b/CONTAINER.md new file mode 100644 index 0000000..b87d65d --- /dev/null +++ b/CONTAINER.md | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | # FCTDrive Container Deployment | ||
| 2 | |||
| 3 | This document explains how to build and run the FCTDrive application as a container. | ||
| 4 | |||
| 5 | ## Prerequisites | ||
| 6 | |||
| 7 | 1. **Build the binaries locally first:** | ||
| 8 | ```bash | ||
| 9 | # Build the Rust CLI tool | ||
| 10 | just build # or: cargo build --release --target-dir target/ | ||
| 11 | |||
| 12 | # Build the frontend (optional, done in container) | ||
| 13 | cd frontend && npm run build | ||
| 14 | ``` | ||
| 15 | |||
| 16 | 2. **Container runtime** (podman, docker, etc.) | ||
| 17 | |||
| 18 | ## Building the Container | ||
| 19 | |||
| 20 | ```bash | ||
| 21 | # Build the container image | ||
| 22 | podman build -t fctdrive:latest . | ||
| 23 | |||
| 24 | # Or with docker | ||
| 25 | docker build -t fctdrive:latest . | ||
| 26 | ``` | ||
| 27 | |||
| 28 | ## Running the Container | ||
| 29 | |||
| 30 | ```bash | ||
| 31 | # Run with volumes for persistent data | ||
| 32 | podman run -d \ | ||
| 33 | --name fctdrive \ | ||
| 34 | -p 3000:3000 \ | ||
| 35 | -v ./blobs:/app/blobs:Z \ | ||
| 36 | -v ./data:/app/data:Z \ | ||
| 37 | -e TINYAUTH_ENDPOINT=http://localhost:3001 \ | ||
| 38 | -e TINYAUTH_PUBLIC_ENDPOINT=http://localhost:3001 \ | ||
| 39 | -e FCTDRIVE_PATH=/app/data \ | ||
| 40 | fctdrive:latest | ||
| 41 | ``` | ||
| 42 | |||
| 43 | ## Environment Variables | ||
| 44 | |||
| 45 | - `TINYAUTH_ENDPOINT` - Internal TinyAuth server URL | ||
| 46 | - `TINYAUTH_PUBLIC_ENDPOINT` - Public TinyAuth server URL (for browser redirects) | ||
| 47 | - `FCTDRIVE_PATH` - Path to the drive data directory | ||
| 48 | - `NODE_ENV=production` (set automatically) | ||
| 49 | - `HOSTNAME=0.0.0.0` (set automatically) | ||
| 50 | |||
| 51 | ## Volume Mounts | ||
| 52 | |||
| 53 | - `/app/blobs` - Blob storage directory | ||
| 54 | - `/app/data` - Drive metadata/database directory | ||
| 55 | |||
| 56 | ## Container Features | ||
| 57 | |||
| 58 | - **Base image**: Fedora 42 | ||
| 59 | - **Runtime**: Node.js + npm | ||
| 60 | - **Binary**: Pre-built `fctdrive` binary in PATH | ||
| 61 | - **User**: Non-root user `fctdrive` | ||
| 62 | - **Port**: 3000 (Next.js server) | ||
| 63 | - **Build**: Production Next.js build | ||
| 64 | |||
| 65 | ## Security | ||
| 66 | |||
| 67 | - Runs as non-root user (`fctdrive:fctdrive`) | ||
| 68 | - Only production dependencies installed | ||
| 69 | - Minimal attack surface with focused .containerignore | ||
| 70 | |||
| 71 | ## Development vs Production | ||
| 72 | |||
| 73 | This container is designed for production deployment. For development: | ||
| 74 | - Use `just dev` for hot-reloading | ||
| 75 | - Mount source code as volumes | ||
| 76 | - Use development dependencies \ No newline at end of file | ||
