Add files via upload

This commit is contained in:
fcarraUniSa
2025-12-10 12:10:20 +01:00
committed by GitHub
parent 09e9174e4b
commit 8e7afde9e3
16 changed files with 1453 additions and 2 deletions

43
Dockerfile.txt Normal file
View File

@@ -0,0 +1,43 @@
# Stage 1: Build the React Application
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package.json to install dependencies first (better caching)
COPY package.json ./
# Install all dependencies (including devDependencies for the build process)
RUN npm install
# Copy the rest of the application source code
COPY . .
# Build the frontend assets (Vite will output to /app/dist)
RUN npm run build
# Stage 2: Setup the Production Server (Node.js)
FROM node:20-alpine
WORKDIR /app
# Copy package.json again for production dependencies
COPY package.json ./
# Install ONLY production dependencies (skips devDependencies like Vite/Typescript)
RUN npm install --omit=dev
# 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 (defaults)
ENV NODE_ENV=production
ENV PORT=3000
# Expose the port the app runs on
EXPOSE 3000
# Start the Node.js server
CMD ["npm", "start"]