-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.npm
More file actions
64 lines (50 loc) · 1.84 KB
/
Dockerfile.npm
File metadata and controls
64 lines (50 loc) · 1.84 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Stage 1: Builder
FROM node:22-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy the mcp package directory
COPY packages/mcp /app/packages/mcp
# Copy shared packages if needed (assuming they are needed for build/pack)
COPY packages/shared /app/packages/shared
COPY packages/config /app/packages/config
# Copy root config
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json
COPY turbo.json /app/turbo.json
# Install dependencies and build
# We need to install dependencies to be able to pack correctly if there are build scripts
# Skip lifecycle scripts (like husky prepare) during Docker build
WORKDIR /app/packages/mcp
# Create the tarball
RUN npm install --ignore-scripts && npm run build && npm pack
# Stage 2: Final Image
FROM node:22-slim
WORKDIR /home/node
# Install build dependencies for native modules (better-sqlite3 needs to compile)
# openssl is required for Prisma
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
openssl \
&& rm -rf /var/lib/apt/lists/*
# Copy the tarball from builder
COPY --from=builder /app/packages/mcp/bigrack-mcp-*.tgz /tmp/bigrack-mcp.tgz
# Install the package globally from the tarball
# better-sqlite3 will compile during installation
RUN npm install -g /tmp/bigrack-mcp.tgz && rm /tmp/bigrack-mcp.tgz
# Remove build dependencies to reduce image size (keep python3 and openssl)
RUN apt-get update && apt-get remove -y make g++ && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
# Switch to non-root user
USER node
ENV USER=bigrack
# Initialize BigRack (this will now run in /home/node without source files pollution)
RUN bigrack init -y
RUN echo "✅ BigRack database updated successfully!"
# Default command
CMD ["bigrack", "start"]