forked from Aayan-infotech/dear30
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (24 loc) · 781 Bytes
/
Dockerfile
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
# Stage 1: Build Stage
FROM node:18-alpine AS build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json to install dependencies
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install --production
# Copy the rest of the application files
COPY . .
# Build the project (assuming build command creates the 'build' folder)
RUN npm run build
# Stage 2: Production Stage
FROM node:18-alpine
# Install 'serve' globally to serve static files
RUN npm install -g serve
# Set the working directory
WORKDIR /app
# Copy only the 'build' folder from the build stage
COPY --from=build /app/build ./build
# Expose port 80 to allow external access
EXPOSE 80
# Serve the application on port 80
CMD ["serve", "-s", "build", "-l", "80"]