-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.25 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# ---------- Build stage ----------
FROM node:22-alpine AS builder
# Enable Corepack (included with Node 22) to manage pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Set working directory
WORKDIR /app
# Copy package files first for better layer caching
COPY package.json pnpm-lock.yaml ./
# Install all dependencies using the lockfile
RUN pnpm install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Build the application
RUN pnpm run build
# ---------- Production stage ----------
FROM node:22-alpine
# Enable Corepack for pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# (Optional) install glibc compatibility if native modules need it
# RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
# Copy package manifests and install only production dependencies
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
# (Optional) Pre-install ask-starknet-mcp globally so npx can find it immediately
# RUN npm install -g @kasarlabs/ask-starknet-mcp && npm cache clean --force
# Copy the compiled build from the builder stage
COPY --from=builder /app/dist ./dist
# Expose application port
EXPOSE 3042
ENV PORT=3042
# Start the application
CMD ["node", "dist/main.js"]