-
Notifications
You must be signed in to change notification settings - Fork 3
feat: comprehensive codebase improvements and Docker optimization #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
e6a98a5
5f8d61d
c24566f
18c7de3
8a47085
df5416f
f089952
91f1638
8e310b1
3512f72
599f6c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,87 @@ | ||
| # Dependencies | ||
| node_modules | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Environment files | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| # Git | ||
| .git | ||
| .env | ||
| .gitignore | ||
| .gitattributes | ||
|
|
||
| # Documentation | ||
| README.md | ||
| CHANGELOG.md | ||
| TODO.md | ||
| *.md | ||
|
|
||
| # IDE and Editor files | ||
| .vscode | ||
| .idea | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS generated files | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Docker files | ||
| Dockerfile* | ||
| docker-compose*.yml | ||
| .dockerignore | ||
|
|
||
| # CI/CD files | ||
| .github | ||
| .husky | ||
|
|
||
| # Test files | ||
| test | ||
| tests | ||
| *.test.js | ||
| *.spec.js | ||
|
|
||
| # Coverage | ||
| coverage | ||
| .nyc_output | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # Development files | ||
| example.* | ||
| oldIndex.js | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Docker Environment Configuration | ||
| # Copy this file to .env and fill in your actual values | ||
|
|
||
| # Required Discord Configuration | ||
| DISCORD_TOKEN=your_discord_bot_token_here | ||
| CLIENT_ID=your_discord_application_client_id | ||
|
|
||
| # Required GitHub Configuration | ||
| REPO_ORG=streamyfin | ||
| REPO_NAME=streamyfin | ||
|
|
||
| # Optional GitHub Configuration | ||
| GITHUB_TOKEN=your_github_personal_access_token | ||
| GITHUB_API_BASE=https://api.github.com | ||
|
|
||
| # Optional Discord Channel Configuration | ||
| FORUM_CHANNEL_ID=your_forum_channel_id | ||
| AI_SUPPORTCHANNEL_ID=your_ai_support_channel_id | ||
| MOD_LOG_CHANNEL_ID=your_moderation_log_channel_id | ||
| CHANNELS_TO_IGNORE=["channel_id_1","channel_id_2"] | ||
|
|
||
| # Optional AI Support Configuration | ||
| AI_APIKEY=your_ai_api_key | ||
| AI_SUPPRT_URL=your_ai_support_service_url | ||
|
|
||
|
Comment on lines
22
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chainTypo in AI support URL variable; standardize to AI_SUPPORT_URL. Rename to avoid confusion; keep backward compat via code. -# Optional AI Support Configuration
-AI_APIKEY=your_ai_api_key
-AI_SUPPRT_URL=your_ai_support_service_url
+# Optional AI Support Configuration
+AI_APIKEY=your_ai_api_key
+AI_SUPPORT_URL=your_ai_support_service_url🏁 Script executed: #!/bin/bash
# Find all occurrences of both spellings to align usage and plan a safe rename
rg -n 'AI_SUPPRT_URL|AI_SUPPORT_URL'Length of output: 424 Standardize AI support URL env var const supportUrl = process.env.AI_SUPPORT_URL || process.env.AI_SUPPRT_URL;🤖 Prompt for AI Agents |
||
| # Optional Content Moderation | ||
| PERSPECTIVE_APIKEY=your_google_perspective_api_key | ||
|
|
||
| # Application Configuration | ||
| LOG_LEVEL=INFO | ||
| ENABLE_RSS_MONITORING=true | ||
| NODE_ENV=production | ||
|
|
||
| # Redis Configuration (handled by docker-compose) | ||
| REDIS_URL=redis://redis:6379 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "env": { | ||
| "es2022": true, | ||
| "node": true | ||
| }, | ||
| "extends": [ | ||
| "eslint:recommended" | ||
| ], | ||
| "parserOptions": { | ||
| "ecmaVersion": "latest", | ||
| "sourceType": "module" | ||
| }, | ||
| "rules": { | ||
| "indent": ["error", 2], | ||
| "linebreak-style": ["error", "unix"], | ||
| "quotes": ["error", "single"], | ||
| "semi": ["error", "always"], | ||
| "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], | ||
| "no-console": "off", | ||
| "prefer-const": "error", | ||
| "no-var": "error", | ||
| "object-shorthand": "error", | ||
| "prefer-template": "error" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,60 @@ | ||
|
|
||
| FROM node:23-alpine | ||
| # Multi-stage build for optimized production image | ||
| FROM node:22-alpine AS base | ||
|
|
||
| # Install dependencies for native modules | ||
| RUN apk add --no-cache python3 make g++ libc6-compat | ||
|
|
||
| WORKDIR /app | ||
|
|
||
|
|
||
| # Copy package files | ||
| COPY package*.json ./ | ||
|
|
||
| FROM base AS dependencies | ||
|
|
||
| # Install all dependencies (including dev dependencies) | ||
| RUN npm ci --include=dev | ||
|
|
||
| RUN npm ci --omit=dev | ||
| FROM base AS build | ||
|
|
||
| # Copy node_modules from dependencies stage | ||
| COPY --from=dependencies /app/node_modules ./node_modules | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Run linting and validation (optional - can be disabled for faster builds) | ||
| RUN npm run lint || echo "Linting failed but continuing build" | ||
|
|
||
| FROM base AS production | ||
|
|
||
| # Create non-root user for security | ||
| RUN addgroup -g 1001 -S nodejs && \ | ||
| adduser -S nodejs -u 1001 | ||
|
|
||
| # Install only production dependencies | ||
| RUN npm ci --omit=dev && npm cache clean --force | ||
retardgerman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Copy application files | ||
| COPY --from=build --chown=nodejs:nodejs /app . | ||
|
|
||
retardgerman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Create data directory for logs and cache | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| RUN mkdir -p /app/data && chown nodejs:nodejs /app/data | ||
|
|
||
| # Switch to non-root user | ||
| USER nodejs | ||
|
|
||
| # Health check | ||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | ||
| CMD node health-check.js | ||
|
|
||
| # Environment variables | ||
| ENV NODE_ENV=production \ | ||
| LOG_LEVEL=INFO \ | ||
| REDIS_URL=redis://redis:6379 | ||
|
|
||
| # Expose port (for potential future web interface) | ||
| EXPOSE 3000 | ||
|
|
||
| # Start the application | ||
| CMD ["node", "index.js"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Don't ignore Dockerfile(s) and compose files.
Excluding these can break docker builds and tooling that rely on default locations.
Proposed change:
Verify your build script doesn’t depend on these being in context:
🏁 Script executed:
Length of output: 3215
Remove
Dockerfile*anddocker-compose*.ymlfrom.dockerignoreThese files are required by default
docker build(no-f) anddocker-compose upcommands.📝 Committable suggestion
🤖 Prompt for AI Agents