From 17914b78ce97012e73a0536147bd15b1a66875ee Mon Sep 17 00:00:00 2001 From: Greg Date: Sun, 18 May 2025 15:48:01 +0200 Subject: [PATCH] chore: initialize project with Next.js and dependencies --- Dockerfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b84d15..812aa4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,30 @@ # Production-ready Dockerfile for Next.js FROM node:20-alpine AS base + +# Set the working directory in the container WORKDIR /app + ENV NODE_ENV=production -# Install dependencies only, then copy source for better caching -COPY package.json package-lock.json* ./ +# Copy package.json and package-lock.json from the 'myfavstuff' subdirectory +COPY myfavstuff/package.json myfavstuff/package-lock.json* ./ + +# Install dependencies +# Using npm ci for cleaner installs based on package-lock.json RUN npm ci --omit=dev -# Copy all files and build the Next.js app -COPY . . +# Copy the rest of your app's source code from the 'myfavstuff' subdirectory +COPY ./myfavstuff/. . + +# Build the Next.js application RUN npm run build # Use a non-root user for security RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001 USER nextjs +# Expose port 3000 (default for Next.js) EXPOSE 3000 + +# Command to run the application CMD ["npm", "start"]