forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
77 lines (64 loc) · 1.88 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
# Use a specific Node.js version for better reproducibility
FROM node:23.3.0-slim AS builder
# Install pnpm globally and necessary build tools
RUN npm install -g pnpm@9.4.0 && \
apt-get update && apt-get install -y \
git \
python3 \
make \
g++ \
libglib2.0-0 \
libnss3 \
libnspr4 \
libdbus-1-3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
libatspi2.0-0 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set Python 3 as the default python
RUN ln -s /usr/bin/python3 /usr/bin/python
# Set the working directory
WORKDIR /app
# Copy package.json and other configuration files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc turbo.json ./
# Copy the rest of the application code
COPY agent ./agent
COPY packages ./packages
COPY scripts ./scripts
# Install dependencies
RUN pnpm install --no-frozen-lockfile
# Install Playwright Browsers
RUN pnpm exec playwright install
# Build the project
RUN pnpm build-docker
# Prune dev dependencies to reduce image size
RUN pnpm prune --prod
# Create a new stage for the final image
FROM node:23.3.0-slim
# Install runtime dependencies if needed
RUN npm install -g pnpm@9.4.0 && \
apt-get update && \
apt-get install -y git python3 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built artifacts and production dependencies from the builder stage
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-workspace.yaml ./
COPY --from=builder /app/.npmrc ./
COPY --from=builder /app/turbo.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/agent ./agent
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/scripts ./scripts