fix(docker): Add build tools for native modules and fix Debian package name
- Add python3 and build-essential to builder stage for bcrypt/sharp compilation - Change libasound2 to libasound2t64 for Debian bookworm compatibility - Copy pre-built node_modules from builder instead of re-running npm install - Prune dev dependencies in builder for smaller production image 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,13 @@
|
|||||||
# Image: code.cannabrands.app/creationshop/dispensary-scraper
|
# Image: code.cannabrands.app/creationshop/dispensary-scraper
|
||||||
FROM code.cannabrands.app/creationshop/node:20-slim AS builder
|
FROM code.cannabrands.app/creationshop/node:20-slim AS builder
|
||||||
|
|
||||||
|
# Install build tools for native modules (bcrypt, sharp)
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python3 \
|
||||||
|
build-essential \
|
||||||
|
--no-install-recommends \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
@@ -10,6 +17,9 @@ RUN npm install
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Prune dev dependencies for smaller production image
|
||||||
|
RUN npm prune --production
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM code.cannabrands.app/creationshop/node:20-slim
|
FROM code.cannabrands.app/creationshop/node:20-slim
|
||||||
|
|
||||||
@@ -32,7 +42,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
fonts-liberation \
|
fonts-liberation \
|
||||||
libnss3 \
|
libnss3 \
|
||||||
libxss1 \
|
libxss1 \
|
||||||
libasound2 \
|
libasound2t64 \
|
||||||
libatk-bridge2.0-0 \
|
libatk-bridge2.0-0 \
|
||||||
libgtk-3-0 \
|
libgtk-3-0 \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
@@ -44,8 +54,7 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install --omit=dev
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
# Copy migrations for auto-migrate on startup
|
# Copy migrations for auto-migrate on startup
|
||||||
|
|||||||
Reference in New Issue
Block a user