From 2c78fa958c61441c77c40275c7892e5972bf1f11 Mon Sep 17 00:00:00 2001 From: robin Date: Tue, 2 Jan 2024 21:38:32 +0800 Subject: [PATCH] Update Dockerfile, blog.config.js, and next.config.js --- Dockerfile | 19 +++++-------------- blog.config.js | 2 +- next.config.js | 3 ++- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9ab9a0b..591c8213 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,16 @@ -FROM node:18-alpine +FROM node:16-alpine WORKDIR /app ENV NODE_ENV production # Uncomment the following line in case you want to disable telemetry during runtime. # ENV NEXT_TELEMETRY_DISABLED 1 -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs +COPY .next/standalone ./ -COPY /app/public ./public +COPY public ./public +COPY package.json ./package.json -# Set the correct permission for prerender cache -RUN mkdir .next -RUN chown nextjs:nodejs .next - -# Automatically leverage output traces to reduce image size -# https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --chown=nextjs:nodejs /app/.next/static ./.next/static - -USER nextjs +COPY .next/static ./.next/static EXPOSE 3000 diff --git a/blog.config.js b/blog.config.js index 8c04954b..7ae54ec2 100644 --- a/blog.config.js +++ b/blog.config.js @@ -4,7 +4,7 @@ const BLOG = { email: 'robin@rnode.me', link: 'https://blog.robin.me', newsletter: 'Weekly', - description: 'A static blog build on top of Notion and Next.js', + description: 'robin blog', lang: 'zh-CN', // ['en-US', 'zh-CN', 'zh-HK', 'zh-TW', 'ja-JP', 'es-ES'] timezone: 'Asia/Shanghai', // See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for all options. appearance: 'auto', // ['light', 'dark', 'auto'], diff --git a/next.config.js b/next.config.js index 33d67efb..ad503298 100644 --- a/next.config.js +++ b/next.config.js @@ -1,13 +1,14 @@ module.exports = { i18n: { locales: ['en', 'zh'], - defaultLocale: 'en', + defaultLocale: 'zh', localeDetection: false }, transpilePackages: ['dayjs'], images: { domains: ['api.craft.do', 'www.notion.so', 'images.unsplash.com', 's3.us-west-2.amazonaws.com'] }, + output: "standalone", async headers() { return [ {