Skip to content

Commit 2a4607a

Browse files
committedNov 30, 2024·
fix docker image and reduce build time
1 parent d188824 commit 2a4607a

File tree

2 files changed

+17
-68
lines changed

2 files changed

+17
-68
lines changed
 

‎Dockerfile

+14-67
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,30 @@
1-
# Stage 1: Build dependencies in a temporary stage
2-
FROM node:23.3.0 AS builder
3-
4-
# Install required global dependencies
5-
RUN apt-get update && apt-get install -y \
6-
python3 \
7-
build-essential \
8-
git \
9-
curl \
10-
sqlite3 && \
11-
apt-get clean \
12-
&& npm install -g pnpm@9.4.0
1+
FROM node:23.3.0
2+
RUN npm install -g pnpm@9.4.0
133

14-
# Set working directory
4+
# Set the working directory
155
WORKDIR /app
166

177
# Add configuration files and install dependencies
188
ADD pnpm-workspace.yaml /app/pnpm-workspace.yaml
199
ADD package.json /app/package.json
2010
ADD .npmrc /app/.npmrc
2111
ADD tsconfig.json /app/tsconfig.json
22-
ADD pnpm-lock.yaml /app/pnpm-lock.yaml
23-
24-
# Install dependencies
25-
RUN pnpm install
12+
ADD turbo.json /app/turbo.json
2613

27-
# Copy source code
14+
# Add the documentation
2815
ADD docs /app/docs
16+
17+
# Add the rest of the application code
18+
ADD agent /app/agent
2919
ADD packages /app/packages
20+
21+
# Add the environment variables
3022
ADD scripts /app/scripts
3123
ADD characters /app/characters
32-
ADD agent /app/agent
33-
34-
# Add dependencies to workspace root
35-
RUN pnpm add -w -D ts-node typescript @types/node
36-
37-
WORKDIR /app/packages/agent
24+
ADD .env /app/.env
3825

39-
# Add dependencies to the agent package specifically
40-
RUN pnpm add -D ts-node typescript @types/node --filter "@ai16z/agent"
41-
42-
WORKDIR /app/packages/core
43-
RUN pnpm add -D ts-node typescript @types/node --filter "@ai16z/eliza"
44-
45-
WORKDIR /app
46-
47-
# Optional: build step if using TypeScript or other build process
26+
RUN pnpm i
4827
RUN pnpm build
4928

50-
# Stage 2: Production image
51-
FROM node:23.3.0
52-
53-
# Install dependencies required for the final runtime
54-
RUN apt-get update && apt-get install -y \
55-
python3 \
56-
build-essential \
57-
git \
58-
curl \
59-
sqlite3 && \
60-
apt-get clean \
61-
&& npm install -g pnpm@9.4.0
62-
63-
# Set working directory
64-
WORKDIR /app
65-
66-
# Copy built files from the builder stage
67-
COPY --from=builder /app /app
68-
69-
# install playwright
70-
RUN pnpm exec playwright install
71-
RUN pnpm exec playwright install-deps
72-
73-
# Expose application port if running a web server
74-
EXPOSE 3000
75-
76-
# Add health check to ensure the app is running
77-
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:3000 || exit 1
78-
79-
# Set environment variables to configure runtime model settings
80-
ENV NODE_ENV=production
81-
82-
# Default command to run the application
83-
CMD ["pnpm", "start"]
29+
# Command to run the container
30+
CMD ["tail", "-f", "/dev/null"]

‎docker-compose.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
services:
22
tee:
33
command: ["pnpm", "start"]
4-
image: hashwarlock/tee-agent:latest
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
57
stdin_open: true
68
tty: true
79
volumes:

0 commit comments

Comments
 (0)
Please sign in to comment.