-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 813 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 813 Bytes
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
FROM node:20-alpine AS builder
# Create app directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies, ignoring any prepare scripts
RUN npm install --ignore-scripts
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Use Node.js 20 Alpine as the base image for the runtime stage
FROM node:20-alpine AS runner
# Set the working directory for the runtime stage
WORKDIR /app
# Copy the built application and dependencies from the builder stage
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/build ./build
RUN npm install --ignore-scripts --omit=dev
# Define environment variables
ENV LEETCODE_SITE=global \
LEETCODE_SESSION=
# Set the default command
ENTRYPOINT ["node","build/index.js"]