diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..97e906d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# Build stage +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +# Production stage +FROM node:18-alpine + +WORKDIR /app + +# Define default values +ARG NODE_ENV=production +ARG PORT=3000 +ARG CACHE_TYPE=memory + +# Set environment variables +ENV NODE_ENV=${NODE_ENV} +ENV HOST=0.0.0.0 +ENV PORT=${PORT} +ENV CACHE_TYPE=${CACHE_TYPE} + +# Copy only production dependencies +COPY package*.json ./ +RUN npm ci --only=production + +# Copy built application +COPY --from=builder /app/dist ./dist + +# Create non-root user +RUN addgroup -g 1001 -S nodejs && \ + adduser -S nodejs -u 1001 + +USER nodejs + +EXPOSE ${PORT} + +CMD ["node", "dist/server.js"] \ No newline at end of file diff --git a/README.md b/README.md index 3092e47..bc18a34 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # CinePro Core 🎬 -## _🌟 Please star this repository! 🌟_ +## _🌟 Star this repository to support us! 🌟_ **OMSS-compliant streaming backend powering the CinePro ecosystem.**
Built with [@omss/framework](https://www.npmjs.com/package/@omss/framework) for extensible, type-safe media scraping and streaming. @@ -23,11 +23,13 @@ Built on the [OMSS template](https://github.com/omss-spec/template), this backen - 🎯 **OMSS-Compliant** – Follows the Open Media Streaming Standard specification - πŸ”Œ **Modular Providers** – Drop-in provider system with auto-discovery - πŸ›‘οΈ **Type-Safe** – Full TypeScript implementation with strict types -- ⚑ **Production-Ready** – Redis caching, Docker support (soon), error handling +- ⚑ **Production-Ready** – Redis caching, Docker support, error handling - 🎬 **Multi-Source** – Support for movies and TV shows from multiple providers - πŸ”„ **Hot Reload** – Development mode with automatic restarts - πŸ“¦ **CineHome Integration** – Compatible with CineHome download automation and any other CinePro ecosystem products +✨Please star this repository if you find it useful! It helps us gain visibility and continue improving the project!✨ + --- ## πŸš€ Quick Start @@ -76,6 +78,46 @@ npm run build npm start ``` +### Docker Deployment + +#### With Docker Compose (includes Redis) + +```bash +# Create .env file with your TMDB_API_KEY +cp .env.example .env +# Edit .env and add your TMDB_API_KEY + +# Start services +docker-compose up -d + +# Server runs at http://localhost:3000 or whatever you set in .env +``` + +#### Standalone Docker + +```bash +# Build image +docker build -t cinepro-core:latest . + +# Run with memory cache +docker run -p 3000:3000 \ + -e TMDB_API_KEY=your_tmdb_api_key_here \ + -e CACHE_TYPE=memory \ + cinepro-core:latest +``` + +#### Custom Configuration + +```bash +# Custom port and Redis +docker run -p 8080:8080 \ + -e PORT=8080 \ + -e TMDB_API_KEY=your_key \ + -e CACHE_TYPE=redis \ + -e REDIS_HOST=your-redis-host \ + cinepro-core:latest +``` + --- ## πŸ“ Project Structure @@ -93,40 +135,6 @@ core/ --- -## πŸ”Œ Adding Providers - -CinePro Core uses an extensible provider system. Each provider implements the `BaseProvider` interface to supply streaming sources. - -### Create a New Provider - -```typescript -// src/providers/mysite.ts -import { BaseProvider } from '@omss/framework'; - -export class MySiteProvider extends BaseProvider { - readonly id = 'mysite'; - readonly name = 'My Streaming Site'; - readonly BASE_URL = 'https://mysite.com'; - readonly capabilities = { - supportedContentTypes: ['movies', 'tv'] - }; - - async getMovieSources(tmdbId: string) { - // Implementation - } - - async getTVSources(tmdbId: string, season: number, episode: number) { - // Implementation - } -} -``` - -### Auto-Discovery - -Place your provider in `src/providers/` and restart the server. The framework automatically discovers and registers new providers. - ---- - ## βš™οΈ Configuration ### Environment Variables diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..3a97ce9 --- /dev/null +++ b/compose.yml @@ -0,0 +1,36 @@ +services: + cinepro-core: + build: . + ports: + - '3000:3000' + environment: + - HOST=0.0.0.0 + - PORT=3000 + - NODE_ENV=production + - TMDB_API_KEY=${TMDB_API_KEY} + - TMDB_CACHE_TTL=86400 + - CACHE_TYPE=redis + - REDIS_HOST=redis + - REDIS_PORT=6379 + depends_on: + - redis + restart: unless-stopped + networks: + - omss-network + + redis: + image: redis:7-alpine + ports: + - '6379:6379' + volumes: + - redis-data:/data + restart: unless-stopped + networks: + - omss-network + +volumes: + redis-data: + +networks: + omss-network: + driver: bridge diff --git a/package-lock.json b/package-lock.json index 9d0e5b6..c172c22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1069,9 +1069,9 @@ } }, "node_modules/find-my-way": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.4.0.tgz", - "integrity": "sha512-5Ye4vHsypZRYtS01ob/iwHzGRUDELlsoCftI/OZFhcLs1M0tkGPcXldE80TAZC5yYuJMBPJQQ43UHlqbJWiX2w==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.5.0.tgz", + "integrity": "sha512-VW2RfnmscZO5KgBY5XVyKREMW5nMZcxDy+buTOsL+zIPnBlbKm+00sgzoQzq1EVh4aALZLfKdwv6atBGcjvjrQ==", "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3",