correzioni build
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,15 +1,16 @@
|
||||
# Stage 1: Build the React Application
|
||||
FROM node:20 AS builder
|
||||
FROM node:20-bookworm AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy ONLY package.json.
|
||||
# We intentionally IGNORE package-lock.json to prevent architecture mismatches
|
||||
# (e.g., trying to install macOS binaries for esbuild on Linux).
|
||||
# Copy ONLY package.json
|
||||
COPY package.json ./
|
||||
|
||||
# Install dependencies from scratch for the container's architecture
|
||||
RUN npm install
|
||||
# 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 . .
|
||||
@@ -18,7 +19,7 @@ COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Setup the Production Server
|
||||
FROM node:20
|
||||
FROM node:20-bookworm-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -26,7 +27,7 @@ WORKDIR /app
|
||||
COPY package.json ./
|
||||
|
||||
# Install ONLY production dependencies
|
||||
RUN npm install --omit=dev
|
||||
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
|
||||
@@ -42,4 +43,4 @@ ENV PORT=3000
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the Node.js server
|
||||
CMD ["npm", "start"]
|
||||
CMD ["npm", "start"]
|
||||
Reference in New Issue
Block a user