Ver Fonte

Update Docker configuration to support SQLite, FFmpeg, and CLI as default shell

- Dockerfile: Added sqlite3 and ffmpeg packages, set CLI as default entrypoint
- docker-compose.yml: Updated for CLI-first approach with data persistence and TTY support
- README.md: Added comprehensive Docker section with usage examples
- apps/cli/README.md: Updated Docker instructions for new CLI-centric container setup
Timothy Pomeroy há 1 mês atrás
pai
commit
c3b3feecc6
4 ficheiros alterados com 89 adições e 13 exclusões
  1. 8 3
      Dockerfile
  2. 59 7
      README.md
  3. 17 2
      apps/cli/README.md
  4. 5 1
      docker-compose.yml

+ 8 - 3
Dockerfile

@@ -1,8 +1,10 @@
 FROM node:20
 
-# Install system dependencies including HandBrakeCLI
+# Install system dependencies including HandBrakeCLI, SQLite, and FFmpeg
 RUN apt-get update && apt-get install -y \
     handbrake-cli \
+    sqlite3 \
+    ffmpeg \
     && rm -rf /var/lib/apt/lists/*
 
 # Install pnpm
@@ -33,5 +35,8 @@ COPY . .
 # Expose ports
 EXPOSE 3000 3001 3002
 
-# Default command
-CMD ["pnpm", "dev"]
+# Set the CLI as the default entrypoint
+ENTRYPOINT ["pnpm", "run", "cli"]
+
+# Default command (can be overridden)
+CMD []

+ 59 - 7
README.md

@@ -50,6 +50,21 @@ graph TB
 
 ## Quick Start
 
+### Option 1: Dev Container (Recommended)
+
+For the most consistent development experience, use the included dev container:
+
+1. Open in VS Code
+2. When prompted, click "Reopen in Container"
+3. Wait for the container to build and dependencies to install
+4. Start developing!
+
+See `.devcontainer/README.md` for detailed setup instructions.
+
+### Option 2: Local Development
+
+If you prefer local development:
+
 ```bash
 # Install dependencies
 pnpm install
@@ -63,15 +78,52 @@ pnpm run service  # API server on :3001
 pnpm run cli      # Interactive CLI
 ```
 
-## Documentation
+## Docker Support
+
+The project includes Docker support for containerized deployment and development.
+
+### Running with Docker Compose
+
+```bash
+# Build and run the application
+docker-compose up --build
+
+# Run in detached mode
+docker-compose up -d
+
+# View logs
+docker-compose logs -f
+
+# Stop the application
+docker-compose down
+```
+
+### Docker Image Features
+
+The Docker image includes:
+- **Node.js 20** with pnpm package manager
+- **HandBrake CLI** for video processing
+- **FFmpeg** for media operations
+- **SQLite3** for database management
+- **CLI as Default Shell**: The container starts with the interactive CLI by default
+
+### Using the CLI in Docker
+
+```bash
+# Interactive CLI (default)
+docker-compose run --rm app
+
+# Direct CLI commands
+docker-compose run --rm app files:list --dataset movies
+docker-compose run --rm app task:list
+
+# Override to run development servers
+docker-compose run --rm app pnpm dev
+```
 
-For detailed information, see:
+### Data Persistence
 
-- **[Web Interface](apps/web/README.md)** - Next.js dashboard documentation
-- **[API Service](apps/service/README.md)** - NestJS backend and API reference
-- **[CLI Tool](apps/cli/README.md)** - Command-line interface guide
-- **[Database Schema](data/README.md)** - SQLite database structure
-- **[Development Notes](docs/DEVELOPMENT_NOTES.md)** - Setup and development guide
+Database files are persisted in the `./data` directory and mounted into the container for data persistence across container restarts.
 
 ## Project Structure
 

+ 17 - 2
apps/cli/README.md

@@ -172,8 +172,23 @@ WATCH_FINISHED_API=http://localhost:3000 pnpm run cli task:list
 
 ## Running in Docker
 
-When running the CLI from within a Docker container:
+The CLI is the default entrypoint for the Docker container, making it easy to run CLI commands:
 
 ```sh
-docker-compose exec service pnpm run cli task:list
+# Interactive CLI (default when running container)
+docker-compose run --rm app
+
+# Direct CLI commands
+docker-compose run --rm app files:list --dataset movies
+docker-compose run --rm app task:list
+docker-compose run --rm app config:get datasets
+
+# Run development servers instead
+docker-compose run --rm app pnpm dev
+```
+
+When running the CLI from within a running Docker container:
+
+```sh
+docker-compose exec app pnpm run cli task:list
 ```

+ 5 - 1
docker-compose.yml

@@ -9,6 +9,10 @@ services:
     volumes:
       - .:/app
       - /app/node_modules
+      - ./data:/app/data  # Persist database files
     environment:
       - NODE_ENV=development
-    command: pnpm dev
+    # CLI is now the default entrypoint, can be overridden with command
+    # command: pnpm dev  # Uncomment to run dev servers instead of CLI
+    stdin_open: true  # Keep stdin open for interactive CLI
+    tty: true         # Allocate a pseudo-TTY for interactive CLI