-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (40 loc) · 1.33 KB
/
Dockerfile
File metadata and controls
56 lines (40 loc) · 1.33 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
# Multi-stage build for TypeScript XMTP Agent
FROM node:22-slim AS builder
# Set working directory
WORKDIR /app
# Copy package files for dependency installation
COPY package.json yarn.lock ./
# Install dependencies (including dev dependencies for building)
RUN yarn install --frozen-lockfile
# Copy source code and configuration files
COPY src/ ./src/
COPY tsconfig.json ./
# Build the TypeScript project
RUN yarn build
# Production stage
FROM node:22-slim AS production
# Install dumb-init and CA certificates for proper operation
RUN apt-get update && apt-get install -y --no-install-recommends \
dumb-init \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json yarn.lock ./
# Install only production dependencies
RUN yarn install --frozen-lockfile --production && \
yarn cache clean
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Create data directory for XMTP database
RUN mkdir -p .data/xmtp
# Declare volume for database persistence
VOLUME ["/app/.data"]
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD node -e "process.exit(0)" || exit 1
# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
# Start the application
CMD ["node", "dist/index.js"]