-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
35 lines (31 loc) · 1.09 KB
/
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
# Use a larger node image to do the build for native deps (e.g., gcc, python)
FROM node:lts-alpine AS deps
WORKDIR /opt/app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
COPY . /
# Install production dependencies only
RUN npm install
# Stage 2: Build the application
FROM node:lts-alpine AS builder
WORKDIR /opt/app
# Copy all files from the current directory to the working directory in the container
COPY . .
# Copy node_modules from the "deps" stage
COPY --from=deps /opt/app/node_modules ./node_modules
# Build the application
RUN npm run build
# Stage 3: Create the production image
FROM node:lts-alpine AS runner
# Set the working directory in the container to /opt/app
WORKDIR /opt/app
# Set environment variable
ENV NODE_ENV=production
# Copy necessary files from the "builder" stage
EXPOSE 5000
COPY --from=builder /opt/app/build ./build
COPY --from=builder /opt/app/docusaurus.config.ts .
COPY --from=builder /opt/app/node_modules ./node_modules
COPY package.json package-lock.json ./
# Define the command to run the application
CMD npm run serve