diff --git a/.dockerignore b/.dockerignore index 4b07d99..54ad555 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,5 +11,26 @@ coverage .env* *.db *.db-journal +/prisma/*.db +/prisma/*.db-journal +.husky +docker-compose.*.yml +jest.config.ts +.prettier* +.eslint* +.editorconfig +LICENSE +Makefile +codespell.txt architecture +__tests__ docker + +/prompts/*.txt +!/prompts/00-*.txt + +/shared/ +!/shared/.gitkeep + +/screenshots/ +!/screenshots/idea-report-*.png diff --git a/Dockerfile b/Dockerfile index 9047190..f0ce0eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,21 +3,23 @@ ARG ALPINE_VERSION="3.20" ARG NPM_SHARP_VERSION="0.33.5" # Install dependencies only when needed -FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS base +FROM node:"${NODE_VERSION}"-alpine"${ALPINE_VERSION}" AS base WORKDIR /app COPY package.json package-lock.json ./ -RUN npm install sharp@${NPM_SHARP_VERSION} && npm ci +RUN npm install "sharp@${NPM_SHARP_VERSION}" && npm ci # Rebuild the source code only when needed -FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS builder +FROM node:"${NODE_VERSION}"-alpine"${ALPINE_VERSION}" AS builder WORKDIR /app COPY --from=base /app/node_modules ./node_modules COPY . . +ENV NODE_ENV production + ENV NEXT_TELEMETRY_DISABLED 1 ARG DOMAIN @@ -53,10 +55,9 @@ ENV CONCEPT_SERVICE_API_BASE=$CONCEPT_SERVICE_API_BASE ARG FEEDBACK_SERVICE_API_BASE ENV FEEDBACK_SERVICE_API_BASE=$FEEDBACK_SERVICE_API_BASE -RUN npm run prisma:generate_client && \ - npm run build +RUN npm run build -FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS prod_builder +FROM node:"${NODE_VERSION}"-alpine"${ALPINE_VERSION}" AS prod_builder WORKDIR /app ENV NODE_ENV production @@ -64,12 +65,10 @@ ENV NODE_ENV production COPY --from=base /app/node_modules ./node_modules COPY . . -RUN npm install && \ - npm run prisma:generate_client && \ - cp -R node_modules prod_node_modules +RUN npm install && cp -R node_modules prod_node_modules # Production image, copy all the files and run next -FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS runner +FROM node:"${NODE_VERSION}"-alpine"${ALPINE_VERSION}" AS runner WORKDIR /app diff --git a/next.config.mjs b/next.config.mjs index 8ca4dc6..f090b16 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -8,6 +8,9 @@ const nextConfig = { trailingSlash: false, output: 'standalone', productionBrowserSourceMaps: false, + experimental: { + instrumentationHook: true, + }, } const bundleAnalyzer = withBundleAnalyzer({ @@ -26,24 +29,9 @@ export default withSentryConfig(bundleAnalyzer(nextConfig), { // For all available options, see: // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ - // Upload a larger set of source maps for prettier stack traces (increases build time) - widenClientFileUpload: true, - - // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. - // This can increase your server load as well as your hosting bill. - // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client- - // side errors will fail. - tunnelRoute: '/monitoring', - // Hides source maps from generated client bundles hideSourceMaps: true, // Automatically tree-shake Sentry logger statements to reduce bundle size disableLogger: true, - - // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.) - // See the following for more information: - // https://docs.sentry.io/product/crons/ - // https://vercel.com/docs/cron-jobs - automaticVercelMonitors: false, }) diff --git a/package.json b/package.json index a410fe1..8fad8c1 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "analyze": "cross-env ANALYZE=true next build", "dev": "NODE_OPTIONS='--inspect --trace-deprecation' next dev", - "build": "next build", + "build": "prisma generate && next build", "start": "next start", "next-lint": "next lint --no-cache", "eslint": "npx eslint . --ext .ts,.tsx,.js,.jsx",