| # Use an official Node runtime as the base image for building the application | |
| FROM node:20 AS build | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy package.json and package-lock.json | |
| COPY app/package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Copy the rest of the application code | |
| COPY app/ . | |
| COPY analysis/data ../analysis/data | |
| # Build the application | |
| RUN npm run build | |
| # Use an official Nginx runtime as the base image for serving the application | |
| FROM nginx:alpine | |
| # Copy the built application from the build stage | |
| COPY --from=build /app/dist /usr/share/nginx/html | |
| # Expose the port the app runs on | |
| EXPOSE 80 | |
| # Command to run the application | |
| CMD ["nginx", "-g", "daemon off;"] |