-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.cli
More file actions
78 lines (60 loc) · 2.07 KB
/
Dockerfile.cli
File metadata and controls
78 lines (60 loc) · 2.07 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# CLI Tools Dockerfile for LSI Ecosystem
# Lightweight image with lsictl CLI tools only
FROM node:25-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache \
python3 \
make \
g++
# Copy package files
COPY package.json package-lock.json ./
COPY packages packages/
# Install all dependencies
RUN npm ci
# Build CLI and its dependencies
RUN npm run build --workspace=@lsi/cli && \
npm run build --workspace=@lsi/core && \
npm run build --workspace=@lsi/protocol && \
npm run build --workspace=@lsi/cascade && \
npm run build --workspace=@lsi/superinstance
# ============================================================================
# CLI Runtime Stage
# ============================================================================
FROM node:25-alpine
RUN apk add --no-cache \
cairo \
jpeg \
pango \
musl \
giflib \
tini
# Create app user
RUN addgroup -g 1001 -S nodejs && \
adduser -S lsi -u 1001
WORKDIR /app
# Set environment
ENV NODE_ENV=production
# Copy built CLI artifacts
COPY --from=builder /app/packages/cli/dist ./packages/cli/dist
COPY --from=builder /app/packages/core/dist ./packages/core/dist
COPY --from=builder /app/packages/protocol/dist ./packages/protocol/dist
COPY --from=builder /app/packages/cascade/dist ./packages/cascade/dist
COPY --from=builder /app/packages/superinstance/dist ./packages/superinstance/dist
# Copy production dependencies only
COPY package.json package-lock.json ./
RUN npm ci --production --no-optional && \
npm cache clean --force
# Copy runtime dependencies from builder
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages/*/node_modules ./packages/*/node_modules 2>/dev/null || true
# Create directories for CLI operations
RUN mkdir -p /app/data /app/cartridges /home/lsi/.lsi && \
chown -R lsi:nodejs /app /home/lsi
USER lsi
# Make CLI executable
RUN chmod +x /app/packages/cli/dist/index.js
# Set CLI as entry point
ENTRYPOINT ["/sbin/tini", "--", "node", "/app/packages/cli/dist/index.js"]
# Default: show help
CMD ["--help"]