29 lines
575 B
Text
29 lines
575 B
Text
|
# Use an official Node.js runtime as a parent image
|
||
|
FROM node:18 AS build
|
||
|
|
||
|
# Set the working directory
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Copy package.json and package-lock.json
|
||
|
COPY package*.json ./
|
||
|
|
||
|
# Install dependencies
|
||
|
RUN npm install
|
||
|
|
||
|
# Copy the rest of the application code
|
||
|
COPY . .
|
||
|
|
||
|
# Build the application
|
||
|
RUN npm run build
|
||
|
|
||
|
# Use an official Nginx image to serve the built application
|
||
|
FROM nginx:alpine
|
||
|
|
||
|
# Copy the built application from the previous stage
|
||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||
|
|
||
|
# Expose port 80
|
||
|
EXPOSE 80
|
||
|
|
||
|
# Start Nginx
|
||
|
CMD ["nginx", "-g", "daemon off;"]
|