-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.19 KB
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 1.19 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
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# ---- Builder Stage ----
# Use specific Node.js Alpine version
FROM node:22-alpine AS builder
WORKDIR /app
# Copy application dependency manifests
COPY package*.json ./
# Install dependencies using clean install
# Cache dependencies using build mount for faster rebuilds
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts
# Copy source code
COPY . .
# Build the project
RUN npm run build
# ---- Release Stage ----
# Use the same specific Node.js Alpine version
FROM node:22-alpine AS release
WORKDIR /app
# Set environment to production
ENV NODE_ENV=production
# Copy built code and necessary package files from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
# Install only production dependencies using clean install
# Cache dependencies using build mount for faster rebuilds
RUN --mount=type=cache,target=/root/.npm npm ci --omit=dev --ignore-scripts
# Install global dependencies again in the final stage
RUN npm install -g @web3-storage/w3cli
# Run as non-root user
USER node
# Set the entry point to run the application
ENTRYPOINT ["node", "dist/index.js"]