1
1
# Use a specific Node.js version for better reproducibility
2
2
FROM node:23.3.0-slim AS builder
3
3
4
- # Install pnpm globally and install necessary build tools
4
+ # Install pnpm globally and necessary build tools
5
5
RUN npm install -g pnpm@9.4.0 && \
6
6
apt-get update && \
7
- apt-get install -y git python3 make g++ && \
7
+ apt-get upgrade -y && \
8
+ apt-get install -y \
9
+ git \
10
+ python3 \
11
+ python3-pip \
12
+ curl \
13
+ node-gyp \
14
+ ffmpeg \
15
+ libtool-bin \
16
+ autoconf \
17
+ automake \
18
+ libopus-dev \
19
+ make \
20
+ g++ \
21
+ build-essential \
22
+ libcairo2-dev \
23
+ libjpeg-dev \
24
+ libpango1.0-dev \
25
+ libgif-dev \
26
+ openssl \
27
+ libssl-dev && \
8
28
apt-get clean && \
9
29
rm -rf /var/lib/apt/lists/*
10
30
11
31
# Set Python 3 as the default python
12
- RUN ln -s /usr/bin/python3 /usr/bin/python
32
+ RUN ln -sf /usr/bin/python3 /usr/bin/python
13
33
14
34
# Set the working directory
15
35
WORKDIR /app
16
36
17
- # Copy package.json and other configuration files
37
+ # Copy only the essential files for dependency installation
18
38
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc turbo.json ./
19
39
40
+ # Install dependencies
41
+ RUN pnpm install --no-frozen-lockfile
42
+
20
43
# Copy the rest of the application code
21
- COPY agent ./agent
22
- COPY packages ./packages
23
- COPY scripts ./scripts
24
- COPY characters ./characters
44
+ COPY . .
25
45
26
- # Install dependencies and build the project
27
- RUN pnpm install \
28
- && pnpm build-docker \
29
- && pnpm prune --prod
46
+ # Build the project
47
+ RUN pnpm run build && pnpm prune --prod
30
48
31
- # Create a new stage for the final image
49
+ # Final runtime image
32
50
FROM node:23.3.0-slim
33
51
34
- # Install runtime dependencies if needed
52
+ # Install runtime dependencies
35
53
RUN npm install -g pnpm@9.4.0 && \
36
54
apt-get update && \
37
- apt-get install -y git python3 && \
55
+ apt-get install -y \
56
+ git \
57
+ python3 \
58
+ ffmpeg && \
38
59
apt-get clean && \
39
60
rm -rf /var/lib/apt/lists/*
40
61
62
+ # Set the working directory
41
63
WORKDIR /app
42
64
43
65
# Copy built artifacts and production dependencies from the builder stage
@@ -47,9 +69,14 @@ COPY --from=builder /app/.npmrc ./
47
69
COPY --from=builder /app/turbo.json ./
48
70
COPY --from=builder /app/node_modules ./node_modules
49
71
COPY --from=builder /app/agent ./agent
72
+ COPY --from=builder /app/client ./client
73
+ COPY --from=builder /app/lerna.json ./
50
74
COPY --from=builder /app/packages ./packages
51
75
COPY --from=builder /app/scripts ./scripts
52
76
COPY --from=builder /app/characters ./characters
53
77
54
- # Set the command to run the application
55
- CMD ["pnpm" , "start" ]
78
+ # Expose necessary ports
79
+ EXPOSE 3000 5173
80
+
81
+ # Command to start the application
82
+ CMD ["sh" , "-c" , "pnpm start & pnpm start:client" ]
0 commit comments