fix(Dockerfile): use node:22-slim for backend (glibc), add linux-headers + nodedir for gateway
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM node:22-alpine
|
FROM node:22-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -6,11 +6,10 @@ WORKDIR /app
|
|||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
# Install build tools for native dependencies (node-crc, @discordjs/opus)
|
# Install build tools for native dependencies (node-crc, @discordjs/opus)
|
||||||
# @discordjs/voice is a shared workspace dependency needed even by backend
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends python3 make g++ wget && rm -rf /var/lib/apt/lists/*
|
||||||
RUN apk add --no-cache python3 make g++
|
|
||||||
|
|
||||||
# Create non-root user
|
# Create non-root user
|
||||||
RUN addgroup -S app && adduser -S -G app app
|
RUN groupadd --system app && useradd --system -g app app
|
||||||
|
|
||||||
# Copy dependency definition files first for better caching
|
# Copy dependency definition files first for better caching
|
||||||
COPY pnpm-workspace.yaml .
|
COPY pnpm-workspace.yaml .
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ RUN addgroup -S app && adduser -S -G app app
|
|||||||
# Install build tools for native dependencies (node-crc, @discordjs/opus)
|
# Install build tools for native dependencies (node-crc, @discordjs/opus)
|
||||||
# and ffmpeg for voice transmit (PCM to OggOpus encoding)
|
# and ffmpeg for voice transmit (PCM to OggOpus encoding)
|
||||||
# This is done early to cache this expensive layer
|
# This is done early to cache this expensive layer
|
||||||
RUN apk add --no-cache python3 make g++ rust cargo ffmpeg
|
RUN apk add --no-cache python3 make g++ rust cargo ffmpeg linux-headers
|
||||||
|
|
||||||
|
# Use bundled node headers for native addon compilation
|
||||||
|
ENV npm_config_nodedir=/usr/local
|
||||||
|
|
||||||
# Copy dependency definition files first for better caching
|
# Copy dependency definition files first for better caching
|
||||||
COPY pnpm-workspace.yaml .
|
COPY pnpm-workspace.yaml .
|
||||||
|
|||||||
Reference in New Issue
Block a user