diff --git a/.gitignore b/.gitignore index bd46e17..87a2e80 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ next-env.d.ts # Environment variables .env + +# Sitemap & Robots +/public/sitemap* +/public/robots.txt diff --git a/Dockerfile b/Dockerfile index c47277a..3168b62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,8 @@ RUN apk add --no-cache libc6-compat WORKDIR /app # Install dependencies based on the preferred package manager -COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ -RUN \ - if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ - elif [ -f package-lock.json ]; then npm ci; \ - elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ - else echo "Lockfile not found." && exit 1; \ - fi +COPY package.json pnpm-lock.yaml* ./ +RUN pnpm install --frozen-lockfile # Rebuild the source code only when needed @@ -26,24 +21,22 @@ COPY . . ARG GIT_REV ENV GIT_REV ${GIT_REV} -# 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. +# Disable telemetry during build ENV NEXT_TELEMETRY_DISABLED 1 -RUN \ - if [ -f yarn.lock ]; then yarn run build; \ - elif [ -f package-lock.json ]; then npm run build; \ - elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ - else echo "Lockfile not found." && exit 1; \ - fi +# Build the frontend +RUN pnpm run build + +# Run postbuild tasks +RUN pnpm run postbuild # Production image, copy all the files and run next FROM base AS runner WORKDIR /app ENV NODE_ENV production -# Uncomment the following line in case you want to disable telemetry during runtime. + +# Disable telemetry during runtime ENV NEXT_TELEMETRY_DISABLED 1 RUN addgroup --system --gid 1001 nodejs diff --git a/next-sitemap.config.js b/next-sitemap.config.js new file mode 100644 index 0000000..a703450 --- /dev/null +++ b/next-sitemap.config.js @@ -0,0 +1,5 @@ +/** @type {import('next-sitemap').IConfig} */ +module.exports = { + siteUrl: process.env.SITE_URL || "https://mcutils.xyz", + generateRobotsTxt: true, +}; diff --git a/package.json b/package.json index a9b3d96..e462c09 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "next dev --turbo", "build": "next build", + "postbuild": "next-sitemap", "start": "next start", "lint": "next lint" }, @@ -36,6 +37,7 @@ "moment": "^2.30.1", "next": "14.2.2", "next-build-id": "^3.0.0", + "next-sitemap": "^4.2.3", "next-themes": "^0.3.0", "react": "^18", "react-countup": "^6.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89292e7..08f571d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -92,6 +92,9 @@ dependencies: next-build-id: specifier: ^3.0.0 version: 3.0.0 + next-sitemap: + specifier: ^4.2.3 + version: 4.2.3(next@14.2.2) next-themes: specifier: ^0.3.0 version: 0.3.0(react-dom@18.2.0)(react@18.2.0) @@ -510,6 +513,10 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: false + /@corex/deepmerge@4.0.43: + resolution: {integrity: sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==} + dev: false + /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -1002,6 +1009,10 @@ packages: react: 18.2.0 dev: false + /@next/env@13.5.6: + resolution: {integrity: sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==} + dev: false + /@next/env@14.2.2: resolution: {integrity: sha512-sk72qRfM1Q90XZWYRoJKu/UWlTgihrASiYw/scb15u+tyzcze3bOuJ/UV6TBOQEeUaxOkRqGeuGUdiiuxc5oqw==} dev: false @@ -6305,6 +6316,20 @@ packages: engines: {node: '>=8'} dev: false + /next-sitemap@4.2.3(next@14.2.2): + resolution: {integrity: sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==} + engines: {node: '>=14.18'} + hasBin: true + peerDependencies: + next: '*' + dependencies: + '@corex/deepmerge': 4.0.43 + '@next/env': 13.5.6 + fast-glob: 3.3.2 + minimist: 1.2.8 + next: 14.2.2(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0) + dev: false + /next-themes@0.3.0(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w==} peerDependencies: