-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 747 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 747 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
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --omit=dev
# Production stage
FROM node:20-alpine AS production
WORKDIR /app
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Copy node_modules from builder stage
COPY --from=builder /app/node_modules ./node_modules
# Copy application source
COPY package*.json ./
COPY src ./src
# Change ownership to non-root user
RUN chown -R nodejs:nodejs /app
# Switch to non-root user
USER nodejs
# Expose port (adjust based on your bot configuration)
EXPOSE 3978
# Default command - can be overridden with docker run or fly.toml
CMD ["node", "src/bot.js"]