-
Notifications
You must be signed in to change notification settings - Fork 4
feat: only fetch incoming event #303
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
30d08cc
chore(node): upgrade node and dockerfile
PaiJi ebe6bfa
chore: update dependencies and refactor imports for next-i18next
PaiJi 67008d6
feat: add TypeScript definitions for TMap and analytics
PaiJi f0310a2
chore: update autoprefixer and postcss-preset-env
PaiJi a030be5
chore: make lint happy
PaiJi afdd748
feat: add coordinate parsing utility
PaiJi 97efda6
feat: implement EventMapCard component
PaiJi 43c8a90
chore(docker): make rabbit happy
PaiJi d52a93e
feat: add map loading error handling and retry
PaiJi afa49cb
feat: reduce index payload
PaiJi e351e8e
fix(zod): fix zod leak to client bundle
PaiJi 0f12865
fix(docker): fix dockerfile
PaiJi 9737859
fix(docker): fix dockerfile
PaiJi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| lts/iron | ||
| lts/krypton |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,116 @@ | ||
| FROM node:20-alpine AS base | ||
| # ============================================ | ||
| # Stage 1: Dependencies Installation Stage | ||
| # ============================================ | ||
|
|
||
| # Install dependencies only when needed | ||
| FROM base AS deps | ||
| # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
| RUN apk add --no-cache libc6-compat | ||
| # IMPORTANT: Node.js Version Maintenance | ||
| # This Dockerfile uses Node.js 24.13.0-slim, which was the latest LTS version at the time of writing. | ||
| # To ensure security and compatibility, regularly update the NODE_VERSION ARG to the latest LTS version. | ||
| ARG NODE_VERSION=24.13.0-slim | ||
|
|
||
| FROM node:${NODE_VERSION} AS dependencies | ||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
| # Install dependencies based on the preferred package manager | ||
| COPY package.json yarn.lock* .yarnrc.yml package-lock.json* pnpm-lock.yaml* ./ | ||
| RUN \ | ||
| if [ -f yarn.lock ]; then corepack enable&&yarn --immutable; \ | ||
| elif [ -f package-lock.json ]; then npm ci; \ | ||
| elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ | ||
| else echo "Lockfile not found." && exit 1; \ | ||
| # Copy package-related files first to leverage Docker's caching mechanism | ||
| COPY package.json yarn.lock* .yarnrc.yml package-lock.json* pnpm-lock.yaml* .npmrc* ./ | ||
|
|
||
| # Install project dependencies with frozen lockfile for reproducible builds | ||
| RUN --mount=type=cache,target=/root/.npm \ | ||
| --mount=type=cache,target=/usr/local/share/.cache/yarn \ | ||
| --mount=type=cache,target=/root/.local/share/pnpm/store \ | ||
| if [ -f package-lock.json ]; then \ | ||
| npm ci --no-audit --no-fund; \ | ||
| elif [ -f yarn.lock ]; then \ | ||
| corepack enable yarn && yarn install --frozen-lockfile --production=false; \ | ||
| elif [ -f pnpm-lock.yaml ]; then \ | ||
| corepack enable pnpm && pnpm install --frozen-lockfile; \ | ||
| else \ | ||
| echo "No lockfile found." && exit 1; \ | ||
| fi | ||
|
|
||
| # ============================================ | ||
| # Stage 2: Build Next.js application in standalone mode | ||
| # ============================================ | ||
|
|
||
| # Rebuild the source code only when needed | ||
| FROM base AS builder | ||
| FROM node:${NODE_VERSION} AS builder | ||
| RUN apk add --no-cache git | ||
|
PaiJi marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
|
|
||
| # Copy project dependencies from dependencies stage | ||
| COPY --from=dependencies /app/node_modules ./node_modules | ||
|
|
||
| # Copy application source code | ||
| COPY . . | ||
|
|
||
| ENV NODE_ENV=production | ||
|
|
||
| # Next.js collects completely anonymous telemetry data about general usage. | ||
| # Learn more here: https://nextjs.org/telemetry | ||
| # Uncomment the following line in case you want to disable telemetry during the build. | ||
| # ENV NEXT_TELEMETRY_DISABLED 1 | ||
| # ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
|
||
| # Build Next.js application | ||
| # If you want to speed up Docker rebuilds, you can cache the build artifacts | ||
| # by adding: --mount=type=cache,target=/app/.next/cache | ||
| # This caches the .next/cache directory across builds, but it also prevents | ||
| # .next/cache/fetch-cache from being included in the final image, meaning | ||
| # cached fetch responses from the build won't be available at runtime. | ||
| RUN if [ -f package-lock.json ]; then \ | ||
| npm run build; \ | ||
| elif [ -f yarn.lock ]; then \ | ||
| corepack enable yarn && yarn build; \ | ||
| elif [ -f pnpm-lock.yaml ]; then \ | ||
| corepack enable pnpm && pnpm build; \ | ||
| else \ | ||
| echo "No lockfile found." && exit 1; \ | ||
| fi | ||
|
|
||
| RUN corepack enable&&yarn build | ||
| # ============================================ | ||
| # Stage 3: Run Next.js application | ||
| # ============================================ | ||
|
|
||
| # If using npm comment out above and use below instead | ||
| # RUN npm run build | ||
| FROM node:${NODE_VERSION} AS runner | ||
|
|
||
| # Production image, copy all the files and run next | ||
| FROM base AS runner | ||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
| ENV NODE_ENV production | ||
| # Uncomment the following line in case you want to disable telemetry during runtime. | ||
| # ENV NEXT_TELEMETRY_DISABLED 1 | ||
| # Set production environment variables | ||
| ENV NODE_ENV=production | ||
| ENV PORT=3000 | ||
| ENV HOSTNAME="0.0.0.0" | ||
|
|
||
| RUN addgroup --system --gid 1001 nodejs | ||
| RUN adduser --system --uid 1001 nextjs | ||
| # Next.js collects completely anonymous telemetry data about general usage. | ||
| # Learn more here: https://nextjs.org/telemetry | ||
| # Uncomment the following line in case you want to disable telemetry during the run time. | ||
| # ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
|
||
| COPY --from=builder /app/public ./public | ||
| # Copy production assets | ||
| COPY --from=builder --chown=node:node /app/public ./public | ||
|
|
||
| # Set the correct permission for prerender cache | ||
| RUN mkdir .next | ||
| RUN chown nextjs:nodejs .next | ||
| RUN chown node:node .next | ||
|
|
||
| # Automatically leverage output traces to reduce image size | ||
| # https://nextjs.org/docs/advanced-features/output-file-tracing | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
| COPY --from=builder --chown=node:node /app/.next/standalone ./ | ||
| COPY --from=builder --chown=node:node /app/.next/static ./.next/static | ||
| #No idea why next-i18n want this | ||
| COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./next.config.js | ||
| COPY --from=builder --chown=nextjs:nodejs /app/next-i18next.config.js ./next-i18next.config.js | ||
|
|
||
| USER nextjs | ||
| # If you want to persist the fetch cache generated during the build so that | ||
| # cached responses are available immediately on startup, uncomment this line: | ||
| # COPY --from=builder --chown=node:node /app/.next/cache ./.next/cache | ||
|
|
||
| EXPOSE 3000 | ||
| # Switch to non-root user for security best practices | ||
| USER node | ||
|
PaiJi marked this conversation as resolved.
|
||
|
|
||
| ENV PORT 3000 | ||
| # set hostname to localhost | ||
| ENV HOSTNAME "0.0.0.0" | ||
| # Expose port 3000 to allow HTTP traffic | ||
| EXPOSE 3000 | ||
|
|
||
| # server.js is created by next build from the standalone output | ||
| # https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
| CMD ["node", "server.js"] | ||
| # Start Next.js standalone server | ||
| CMD ["node", "server.js"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,56 @@ | ||
| declare const VERSION: string; | ||
| declare const COMMITHASH: string; | ||
| declare const BRANCH: string; | ||
|
|
||
| type TrackEventValue = Record<string, unknown>; | ||
| type TMapLatLngInstance = object; | ||
|
|
||
| interface AnalyticsTracker { | ||
| track: (eventName: string, eventValue?: TrackEventValue) => void; | ||
| } | ||
|
|
||
| interface TMapMapInstance { | ||
| on: (eventName: string, handler: () => void) => void; | ||
| } | ||
|
|
||
| interface TMapNamespace { | ||
| LatLng: new (lat: number | undefined, lng: number | undefined) => TMapLatLngInstance; | ||
| Map: new ( | ||
| container: HTMLElement | null, | ||
| options: { | ||
| center: TMapLatLngInstance; | ||
| zoom: number; | ||
| pitch: number; | ||
| rotation: number; | ||
| } | ||
| ) => TMapMapInstance; | ||
| MultiMarker: new (options: { | ||
| id: string; | ||
| map: TMapMapInstance; | ||
| styles: { | ||
| marker: unknown; | ||
| }; | ||
| geometries: Array<{ | ||
| id: string; | ||
| styleId: string; | ||
| position: TMapLatLngInstance; | ||
| properties: { | ||
| title: string; | ||
| }; | ||
| }>; | ||
| }) => unknown; | ||
| MarkerStyle: new (options: { | ||
| width: number; | ||
| height: number; | ||
| anchor: { | ||
| x: number; | ||
| y: number; | ||
| }; | ||
| }) => unknown; | ||
| } | ||
|
|
||
| interface Window { | ||
| gtag?: (command: "event", eventName: string, eventValue?: TrackEventValue) => void; | ||
| TMap?: TMapNamespace; | ||
| umami?: AnalyticsTracker; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
🏁 Script executed:
Repository: FurryConsChina/website
Length of output: 78
🏁 Script executed:
Repository: FurryConsChina/website
Length of output: 76
🏁 Script executed:
# 读取 Dockerfile 完整内容 cat -n DockerfileRepository: FurryConsChina/website
Length of output: 5052
🏁 Script executed:
Repository: FurryConsChina/website
Length of output: 48
🏁 Script executed:
Repository: FurryConsChina/website
Length of output: 175
🏁 Script executed:
Repository: FurryConsChina/website
Length of output: 48
🏁 Script executed:
# 读取 .dockerignore 文件内容 cat -n .dockerignoreRepository: FurryConsChina/website
Length of output: 175
🏁 Script executed:
# 直接读取 .dockerignore cat .dockerignoreRepository: FurryConsChina/website
Length of output: 133
不要直接复制
.npmrc到构建层。Line 16 在
COPY命令中包含.npmrc*的通配符模式。如果.npmrc包含 npm registry 凭据,当前做法会将其作为普通文件复制到镜像层,导致凭据暴露在构建缓存中。Docker 官方推荐使用 BuildKit secret mount 处理敏感凭据,使其仅在安装命令期间临时可见。建议修改
参考:Docker BuildKit Secrets Documentation
🤖 Prompt for AI Agents