forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
83 lines (63 loc) · 1.98 KB
/
Dockerfile
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
79
80
81
82
83
# Stage 1: Build dependencies in a temporary stage
FROM node:23.3.0 AS builder
# Install required global dependencies
RUN apt-get update && apt-get install -y \
python3 \
build-essential \
git \
curl \
sqlite3 && \
apt-get clean \
&& npm install -g pnpm@9.4.0
# Set working directory
WORKDIR /app
# Add configuration files and install dependencies
ADD pnpm-workspace.yaml /app/pnpm-workspace.yaml
ADD package.json /app/package.json
ADD .npmrc /app/.npmrc
ADD tsconfig.json /app/tsconfig.json
ADD pnpm-lock.yaml /app/pnpm-lock.yaml
# Install dependencies
RUN pnpm install
# Copy source code
ADD docs /app/docs
ADD packages /app/packages
ADD scripts /app/scripts
ADD characters /app/characters
ADD agent /app/agent
# Add dependencies to workspace root
RUN pnpm add -w -D ts-node typescript @types/node
WORKDIR /app/packages/agent
# Add dependencies to the agent package specifically
RUN pnpm add -D ts-node typescript @types/node --filter "@ai16z/agent"
WORKDIR /app/packages/core
RUN pnpm add -D ts-node typescript @types/node --filter "@ai16z/eliza"
WORKDIR /app
# Optional: build step if using TypeScript or other build process
RUN pnpm build
# Stage 2: Production image
FROM node:23.3.0
# Install dependencies required for the final runtime
RUN apt-get update && apt-get install -y \
python3 \
build-essential \
git \
curl \
sqlite3 && \
apt-get clean \
&& npm install -g pnpm@9.4.0
# Set working directory
WORKDIR /app
# Copy built files from the builder stage
COPY --from=builder /app /app
# install playwright
RUN pnpm exec playwright install
RUN pnpm exec playwright install-deps
# Expose application port if running a web server
EXPOSE 3000
# Add health check to ensure the app is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:3000 || exit 1
# Set environment variables to configure runtime model settings
ENV NODE_ENV=production
# Default command to run the application
CMD ["pnpm", "start"]