diff --git a/Dockerfile b/Dockerfile index 7358148..12a909d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,46 +1,12 @@ -# Stage 1: Build the React Application -FROM node:20-bookworm AS builder +FROM node:18-alpine WORKDIR /app -# Copy ONLY package.json -COPY package.json ./ +COPY package*.json ./ +RUN npm ci --only=production -# Install dependencies -# --legacy-peer-deps: Ignores peer dependency conflicts -# --no-audit: Skips vulnerability audit (faster, less noise) -# --no-fund: Hides funding messages -RUN npm install --legacy-peer-deps --no-audit --no-fund - -# Copy the rest of the application source code COPY . . -# Build the frontend assets -RUN npm run build - -# Stage 2: Setup the Production Server -FROM node:20-bookworm-slim - -WORKDIR /app - -# Copy ONLY package.json -COPY package.json ./ - -# Install ONLY production dependencies -RUN npm install --omit=dev --legacy-peer-deps --no-audit --no-fund - -# Copy the built frontend assets from the 'builder' stage -COPY --from=builder /app/dist ./dist - -# Copy the server entry point -COPY server.js ./ - -# Set environment variables -ENV NODE_ENV=production -ENV PORT=3000 - -# Expose the port EXPOSE 3000 -# Start the Node.js server -CMD ["npm", "start"] \ No newline at end of file +CMD ["node", "server.js"]