fix: Set HOSTNAME environment variable in Dockerfile#622
Conversation
Add HOSTNAME environment variable for container
Summary of ChangesHello @yllhwa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a change to the Dockerfile to explicitly define the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthrough在deploy/Dockerfile的runner阶段添加了环境变量 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This PR correctly sets the HOSTNAME environment variable for the Next.js standalone server in the production Dockerfile. However, this makes the existing HOST variable redundant and it should be removed for clarity. A more significant issue is that the same fix is required for the development Dockerfile (deploy/Dockerfile.dev) to ensure consistency between environments, as it currently uses the incorrect HOST variable and has not been updated in this pull request.
| ENV NODE_ENV=production | ||
| ENV PORT=3000 | ||
| ENV HOST=0.0.0.0 | ||
| ENV HOSTNAME=0.0.0.0 |
There was a problem hiding this comment.
While adding HOSTNAME is the correct fix for the Next.js standalone server, it makes the ENV HOST=0.0.0.0 on the previous line redundant. The standalone server only respects the HOSTNAME variable for setting the bind address. To improve code clarity and prevent future confusion, the now-unused HOST variable should be removed.
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
There was a problem hiding this comment.
Code Review Summary
No significant issues identified in this PR.
PR Size: XS
- Lines changed: 1
- Files changed: 1
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - N/A (Dockerfile ENV declaration)
- Type safety - N/A (Dockerfile)
- Documentation accuracy - Clean
- Test coverage - N/A (Infrastructure change)
- Code clarity - Good
Automated review by Claude AI
* fix: 清理 usage-doc / big-screen i18n 硬编码 + 修复 Next.js params Promise 报错 * feat(leaderboard): add user tag and group filters for user ranking (#607) * feat(leaderboard): add user tag and group filters for user ranking (#606) Add filtering capability to the leaderboard user ranking by: - userTags: filter users by their tags (OR logic) - userGroups: filter users by their providerGroup (OR logic) Changes: - Repository: Add UserLeaderboardFilters interface and SQL filtering - Cache: Extend LeaderboardFilters and include filters in cache key - API: Parse userTags/userGroups query params (CSV format, max 20) - Frontend: Add TagInput filters (admin-only, user scope only) - i18n: Add translation keys for 5 languages Closes #606 * refactor: apply reviewer suggestions for leaderboard filters - Use JSONB ? operator instead of @> for better performance - Extract parseListParam helper to reduce code duplication * feat(leaderboard): add tag/group suggestions dropdown for better UX - Fetch all user tags and groups via getAllUserTags/getAllUserKeyGroups - Pass suggestions to TagInput for autocomplete dropdown - Validate input against available suggestions - Consistent with /dashboard/users filter behavior * docs: update Privnode offer details in README files * fix: 修复 1M 上下文标头兼容问题 * fix: resolve container name conflicts in multi-user environments (#625) * fix: resolve container name conflicts in multi-user environments - Add top-level `name` field with COMPOSE_PROJECT_NAME env var support - Remove hardcoded container_name from all services - Users can now set COMPOSE_PROJECT_NAME in .env for complete isolation Closes #624 * fix: add top-level name field for project isolation Add `name: ${COMPOSE_PROJECT_NAME:-claude-code-hub}` to enable complete project isolation via environment variable. * feat(dashboard): improve user management, statistics reset, and i18n (#610) * fix(dashboard/logs): add reset options to filters and use short time format - Add "All keys" SelectItem to API Key filter dropdown - Add "All status codes" SelectItem to Status Code filter dropdown - Use __all__ value instead of empty string (Radix Select requirement) - Add formatDateDistanceShort() for compact time display (2h ago, 3d ago) - Update RelativeTime component to use short format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(providers): add Auto Sort button to dashboard and fix i18n - Add AutoSortPriorityDialog to dashboard/providers page - EN: "Auto Sort Priority" -> "Auto Sort" - RU: "Авто сортировка приоритета" -> "Автосорт" - RU: "Добавить провайдера" -> "Добавить поставщика" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(i18n): improve Russian localization and fix login errors Russian localization improvements: - Menu: "Управление поставщиками" -> "Поставщики" - Menu: "Доступность" -> "Мониторинг" - Filters: "Последние 7/30 дней" -> "7д/30д" - Dashboard: "Статистика использования" -> "Статистика" - Dashboard: "Показать статистику..." -> "Только ваши ключи" - Quota: add missing translations (manageNotice, withQuotas, etc.) Login error localization: - Fix issue where login errors displayed in Chinese ("无效或已过期") regardless of locale - Add locale detection from NEXT_LOCALE cookie and Accept-Language header - Add 3 new error keys: apiKeyRequired, apiKeyInvalidOrExpired, serverError - Support all 5 languages: EN, JA, RU, ZH-CN, ZH-TW - Remove product name from login privacyNote for all locales Files changed: - messages/*/auth.json: new error keys, update privacyNote - messages/ru/dashboard.json, messages/ru/quota.json: Russian improvements - src/app/api/auth/login/route.ts: add getLocaleFromRequest() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(dashboard/users): improve user management with key quotas and tokens - Add access/model restrictions support (allowedClients/allowedModels) - Add tokens column and refresh button to users table - Add todayTokens calculation in repository layer (sum all token types) - Add visual status indicators with color-coded icons (active/disabled/expiring/expired) - Allow users to view their own key quota (was admin-only) - Fix React Query cache invalidation on status toggle - Fix filter logic: change tag/keyGroup from OR to AND - Refactor time display: move formatDateDistanceShort to component with i18n - Add fixed header/footer to key dialogs for better UX Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(dashboard/users): add reset statistics with optimized Redis pipeline - Implement reset all statistics functionality for admins - Optimize Redis operations: replace sequential redis.keys() with parallel SCAN - Add scanPattern() helper for production-safe key scanning - Comprehensive error handling and performance metrics logging - 50-100x performance improvement with no Redis blocking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix(lint): apply biome formatting and fix React hooks dependencies - Fix useEffect dependencies in RelativeTime component (wrap formatShortDistance in useCallback) - Remove unused effectiveGroupText variable in key-row-item.tsx - Apply consistent LF line endings across modified files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: address code review feedback from PR #610 - Remove duplicate max-h class in edit-key-dialog.tsx (keep max-h-[90dvh] only) - Add try-catch fallback for getTranslations in login route catch block Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: translate Russian comments to English for consistency Addresses Gemini Code Assist review feedback. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(users): add unit tests for resetUserAllStatistics function Cover all requirement scenarios: - Permission check (admin-only) - User not found handling - Success path with DB + Redis cleanup - Redis not ready graceful handling - Redis partial failure warning - scanPattern failure warning - pipeline.exec failure error logging - Unexpected error handling - Empty keys list handling 10 test cases with full mock coverage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: John Doe <johndoe@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * feat(my-usage): cache statistics and timezone fixes (#623) * feat(my-usage): add cache token statistics to model breakdown Add cacheCreationTokens and cacheReadTokens fields to ModelBreakdownItem interface and related DB queries for displaying cache statistics in the statistics summary card modal. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(my-usage): use configured timezone for date filtering Use server timezone (TZ config) instead of browser locale when: - Filtering statistics by date (getMyStatsSummary) - Calculating daily quota time ranges (getTimeRangeForPeriod) This ensures consistent date interpretation across different client timezones. Fixes discrepancy between Daily Quota and Statistics Summary when user is in a different timezone than the server. Added comprehensive unit tests covering: - Date parsing in configured timezone - Timezone offset calculations - Day boundary edge cases * refactor(my-usage): clean up expiration displays Remove duplicate expiration information: - Remove Key Expires chip from Welcome header (keep User Expires only) - Remove "Expiring Soon" warning block from Quota Usage cards Improve countdown display in ExpirationInfo component: - Add Clock icon - Increase font size to match date display - Use monospace font for better readability - Color-coded by status (emerald/amber/red) ExpirationInfo remains the single source of expiration data. * fix: correct cache hit rate formula to exclude output tokens Output tokens are never cached (per Anthropic docs), so they should not be included in cache hit rate calculation. Changed formula from: cacheReadTokens / (input + output + cacheCreate + cacheRead) to: cacheReadTokens / (input + cacheCreate + cacheRead) Affects: - /my-usage model breakdown cache hit rate display - /dashboard/leaderboard provider cache hit rate ranking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: address PR #623 review feedback - Fix outdated cache hit rate comment (leaderboard.ts:430) - Add keyboard accessibility to model breakdown rows (a11y) - Rename totalTokens -> totalInputTokens in ProviderCacheHitRateLeaderboardEntry - Extract parseDateRangeInServerTimezone helper to reduce duplication Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: add backward compatibility for totalTokens field Keep returning totalTokens (deprecated) alongside totalInputTokens for API consumers that haven't migrated yet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: John Doe <johndoe@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * fix: Set HOSTNAME environment variable in Dockerfile (#622) Add HOSTNAME environment variable for container * fix: inherit 1M flag from client Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix(my-usage): make date range DST-safe Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * test(api): cover leaderboard comma-list parsing Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix(auth): avoid hardcoded server error fallback Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix(actions): localize key quota permission errors Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * docs: clarify context 1M inherit behavior Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * test(settings): fix model multi-select messages loader Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * test(dashboard): provide QueryClientProvider in edit key form test Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * chore(scripts): avoid hardcoded docker container names Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix(i18n): replace fullwidth parentheses in ja dashboard Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix(ui): add a11y label and clean up dialog styles Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * chore: ignore tmp scratch directory Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * feat: Dashboard Logs:秒级时间筛选 + Session ID 精确筛选/联想/展示(含回归修复) (#611) * feat: add sessionId filter for usage logs * feat: add seconds-level time filters for logs * feat: wire sessionId into logs URL filters * chore: add i18n keys for logs sessionId * feat: add sessionId column to logs tables * feat: add sessionId suggestions for logs * docs: document dashboard logs call chain * test: add logs sessionId/time filter coverage config * fix: keep sessionId search input focused * fix: drop leaked page param on logs apply * fix: reload sessionId suggestions on scope change * fix: harden logs url params and time parsing * fix: avoid keys join for sessionId suggestions * test: strengthen empty sessionId filter assertions * chore: format logs sessionId suggestions test * Update src/actions/usage-logs.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: 补充公共静态变量 SESSION_ID_SUGGESTION_LIMIT * fix: use prefix LIKE for sessionId suggestions * refactor: centralize usage logs sessionId suggestion constants * refactor: simplify logs url filters parsing * refactor: reuse clipboard util for sessionId copy * chore(db): add sessionId prefix index * docs: clarify sessionId suggestion semantics * test: add escapeLike unit tests * chore: apply biome fixes for sessionId search * feat: include session id in error responses * test: add coverage suite for session id errors * docs: add guide for error session id * chore: format code (feat-logs-sessionid-time-filter-233f96a) * feat(dashboard/logs): add fullscreen mode (#632) * Fix provider exhaustion after model redirect (refs #629) (#633) * Fix provider fallback after model redirect Use original model for provider selection during failover and tolerate tool_result blocks in non-stream converters to prevent premature provider exhaustion. References #629. * Add regression test for model redirect provider selection Ensures provider selection uses original model even when current model is redirected (refs #629). * chore: format code (fix-629-provider-fallback-toolresult-b17f671) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: YangQing-Lin <56943790+YangQing-Lin@users.noreply.github.com> Co-authored-by: SaladDay <92240037+SaladDay@users.noreply.github.com> Co-authored-by: miraserver <20286838+miraserver@users.noreply.github.com> Co-authored-by: John Doe <johndoe@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: hwa <yll2002mail@gmail.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Ding <ding113@users.noreply.github.com> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary
Adds the
HOSTNAMEenvironment variable to the Dockerfile to fix container accessibility issues on Windows with Docker Compose.Problem
When running the container on Windows with Docker Compose, the Next.js standalone server listens on the container's hostname instead of
0.0.0.0, making the application inaccessible from the host network.Related Issues:
Solution
Add
ENV HOSTNAME=0.0.0.0to the Dockerfile runner stage. Next.js standalone server reads theHOSTNAMEenvironment variable (notHOST) to determine the binding address. Without this, the server falls back to default behavior which causes binding issues on Windows.Changes
Core Changes
deploy/Dockerfile: AddedENV HOSTNAME=0.0.0.0environment variable alongside the existingHOSTvariableTechnical Details
Next.js standalone mode uses
process.env.HOSTNAMEto determine the server binding address:The existing
ENV HOST=0.0.0.0is not used by Next.js standalone server, soHOSTNAMEmust be explicitly set for proper container networking.Testing
Manual Testing
docker compose upon Windowslocalhost:3000Description enhanced by Claude AI