-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 908 Bytes
/
Dockerfile
File metadata and controls
40 lines (27 loc) · 908 Bytes
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
# Build stage
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lock* ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Production stage
FROM oven/bun:1 AS production
WORKDIR /app
# Create non-root user for security
RUN groupadd --system --gid 1001 botgroup && \
useradd --system --uid 1001 --gid botgroup botuser
# Copy built application
COPY --from=builder --chown=botuser:botgroup /app/node_modules ./node_modules
COPY --from=builder --chown=botuser:botgroup /app/src ./src
COPY --from=builder --chown=botuser:botgroup /app/package.json ./
USER botuser
# Set environment variables
ENV NODE_ENV=production
# Health check - verify the process is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD pidof bun | grep -qw 1 || exit 1
# Run the bot
CMD ["bun", "run", "src/index.ts"]