Install sharp dependencies for Linux
This commit is contained in:
+15
-4
@@ -1,20 +1,31 @@
|
||||
FROM oven/bun:1 AS build-stage
|
||||
WORKDIR /app
|
||||
|
||||
# Limit memory for Node processes (3 GB)
|
||||
# Install sharp dependencies for Linux
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY package.json bun.lockb* ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# --- ✅ Rebuild sharp for correct Linux architecture ---
|
||||
RUN bun x npm rebuild sharp --platform=linux --arch=x64 --target=$(node -v | sed 's/v//')
|
||||
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
FROM oven/bun:1 AS production-stage
|
||||
WORKDIR /app
|
||||
|
||||
# Install sharp dependencies in production stage as well
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build-stage /app /app
|
||||
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
CMD ["bun", "run", "start"]
|
||||
Reference in New Issue
Block a user