-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (47 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
63 lines (47 loc) · 1.54 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
# ---- Build stage ----
FROM node:20-slim AS build
WORKDIR /app
# Install build tools for native modules (better-sqlite3)
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files and SDK workspace (needed for workspace resolution)
COPY package.json package-lock.json ./
COPY packages/sdk/package.json packages/sdk/
# Install all deps (including devDependencies for build + SDK workspace)
RUN npm ci
# Copy source, build configs, and full SDK source
COPY tsconfig.json tsup.config.ts ./
COPY src/ src/
COPY packages/ packages/
# Copy frontend source and install its deps
COPY web/ web/
RUN cd web && npm ci
# Build everything: SDK → backend (tsup) → frontend (vite)
RUN npm run build
# ---- Runtime stage ----
FROM node:20-slim
WORKDIR /app
# Copy package files and install production deps only
COPY package.json package-lock.json ./
RUN npm pkg delete scripts.prepare \
&& npm ci --omit=dev \
&& npm cache clean --force
# Copy pre-built native module from build stage
COPY --from=build /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node
# Copy compiled code, bin wrapper, and templates
COPY --from=build /app/dist/ dist/
COPY bin/ bin/
COPY src/templates/ src/templates/
# Data directory for persistence
ENV TELETON_HOME=/data
VOLUME /data
# Run as non-root
RUN chown -R node:node /app
USER node
# WebUI port (when enabled)
EXPOSE 7777
ENTRYPOINT ["node", "dist/cli/index.js"]
CMD ["start"]