From f727b212df75d9a61ee613e880a07a22cff8797a Mon Sep 17 00:00:00 2001 From: mei Date: Fri, 13 Dec 2024 21:40:52 +0800 Subject: [PATCH] update --- Dockerfile | 30 ++++++++++++++++++ app/hooks/useConfig.ts | 6 ---- app/layout.tsx | 4 ++- app/page.tsx | 10 ++---- components/ActivityCard.tsx | 43 +------------------------ components/InventoryManagement.tsx | 2 +- components/footer.tsx | 50 ++++++++++++++++++++++++++++++ data/config.yaml | 27 ++-------------- next.config.js | 11 +++++++ next.config.mjs | 4 --- types/activity.ts | 1 - 11 files changed, 101 insertions(+), 87 deletions(-) create mode 100644 Dockerfile create mode 100644 components/footer.tsx create mode 100644 next.config.js delete mode 100644 next.config.mjs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba725dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Stage 1: Install dependencies +FROM node:18-alpine AS builder +WORKDIR /app +RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories +RUN apk update +RUN npm config set registry https://registry.npmmirror.com +COPY package*.json ./ +RUN npm ci + +# Stage 2: Build the applicatio +COPY . . +RUN npm run build + +# Stage 3: Production image +FROM node:18-alpine AS runner +RUN mkdir -p /app/data && chmod 755 /app/data +WORKDIR /app +RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories +RUN apk update +ENV NODE_ENV Production +COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package*.json ./ +COPY --from=builder /app/data/shorturl.db ./data +VOLUME /app/data + +# Run App +CMD ["node", "server.js"] \ No newline at end of file diff --git a/app/hooks/useConfig.ts b/app/hooks/useConfig.ts index 61c7ab5..f69644d 100644 --- a/app/hooks/useConfig.ts +++ b/app/hooks/useConfig.ts @@ -1,17 +1,11 @@ import { useState, useEffect } from 'react'; import yaml from 'yaml'; -// 定义活动项的接口 -interface ActivityParticipant { - name: string; -} - interface Activity { title: string; coverImage: string; description: string; date: string; - participants: ActivityParticipant[]; organizer: string; } diff --git a/app/layout.tsx b/app/layout.tsx index c9f1982..4fc8430 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,11 +1,12 @@ import './globals.css' import { Inter } from 'next/font/google' import Navbar from '@/components/Navbar' +import Footer from '@/components/footer' const inter = Inter({ subsets: ['latin'] }) export const metadata = { - title: '影视星河摄影社团', + title: '影视星河', description: '影视星河摄影社团官方网站', } @@ -19,6 +20,7 @@ export default function RootLayout({ {children} +