N4SM / frontend /Dockerfile.prod
gaialive's picture
Upload 20 files
d591eb1 verified
raw
history blame contribute delete
592 Bytes
# Use the official Node.js image as base
FROM node:18-alpine as build
# Set the working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Use nginx to serve the static files
FROM nginx:alpine
# Copy the build output to the nginx html directory
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]