File size: 1,008 Bytes
e4890d1 c209718 e2d6134 e4890d1 c209718 e4890d1 c209718 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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
# Copy a custom Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Create necessary directories and set permissions
RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx && \
chmod -R 777 /var/cache/nginx /var/run /var/log/nginx /etc/nginx/nginx.conf
# Switch to non-root user
USER nginx
# Expose port 8080
EXPOSE 8080
# Command to run the application
CMD ["nginx", "-g", "daemon off;"]
|