fix(docker): add canvas native deps for jsdom/vitest

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 <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-12-31 12:23:32 -06:00
parent 473b7dbd7c
commit 5f51bc1871
1 changed files with 17 additions and 5 deletions

View File

@ -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"]