forked from Bryan-Kuang/FM-Hachimi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 827 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 827 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
# Multi-stage build for Bilibili Discord Bot
FROM node:22-alpine AS base
# Install system dependencies (ffmpeg, python for yt-dlp)
RUN apk add --no-cache \
ffmpeg \
python3 \
py3-pip \
ca-certificates
# Install yt-dlp
RUN pip3 install --no-cache-dir --break-system-packages yt-dlp
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install Node dependencies
RUN npm ci --omit=dev --ignore-scripts && \
npm cache clean --force
# Copy application source
COPY src ./src
# Use existing non-root 'node' user (uid 1000 in node:alpine)
RUN chown -R node:node /app
USER node
# Environment
ENV NODE_ENV=production
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('./src/index.js')" || exit 1
# Run the bot
CMD ["node", "src/index.js"]