From 5f51bc1871aec325feb32a0b29edabb3b6c5dd1f Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Wed, 31 Dec 2025 12:23:32 -0600 Subject: [PATCH] fix(docker): add canvas native deps for jsdom/vitest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit canvas is an optional dependency of jsdom (used by vitest) and requires native libraries (cairo, pango, pixman) to build on Alpine. Add these dependencies to the base stage. Also fix legacy ENV format warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- Dockerfile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79cc7613..52da49fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,20 @@ # Multi-stage build for Soroban Abacus Flashcards FROM node:20-alpine AS base -# Install Python and build tools for better-sqlite3 -RUN apk add --no-cache python3 py3-setuptools make g++ +# Install Python, build tools for better-sqlite3, and canvas native dependencies +# canvas is an optional dep of jsdom (used by vitest) and requires cairo/pango +RUN apk add --no-cache \ + python3 \ + py3-setuptools \ + make \ + g++ \ + pkgconfig \ + cairo-dev \ + pango-dev \ + libjpeg-turbo-dev \ + giflib-dev \ + librsvg-dev \ + pixman-dev # Install pnpm and turbo RUN npm install -g pnpm@9.15.4 turbo@1.10.0 @@ -155,9 +167,9 @@ RUN mkdir -p data/uploads && chown -R nextjs:nodejs data USER nextjs EXPOSE 3000 -ENV PORT 3000 -ENV HOSTNAME "0.0.0.0" -ENV NODE_ENV production +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" +ENV NODE_ENV=production # Start the application CMD ["node", "server.js"]