fix: replace trianglify with pure browser gradient mesh generator

- Removed trianglify dependency (which required Node.js canvas)
- Implemented custom gradient mesh using HTML5 Canvas API
- Browser-native solution works in Docker without native dependencies
- Maintains daily variation and theme color support
- No more 'i.from is not a function' errors
This commit is contained in:
Muhammad Ibrahim
2025-10-28 18:47:56 +00:00
parent 2975da0f69
commit 1d2c003830
5 changed files with 129 additions and 524 deletions

View File

@@ -17,9 +17,6 @@ CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000"]
# Builder stage for production
FROM node:lts-alpine AS builder
# Install build dependencies for canvas
RUN apk add --no-cache python3 make g++ pkgconfig cairo-dev jpeg-dev pango-dev giflib-dev
WORKDIR /app/frontend
COPY frontend/package*.json ./
@@ -27,8 +24,8 @@ COPY frontend/package*.json ./
RUN echo "=== Starting npm install ===" &&\
npm cache clean --force &&\
rm -rf node_modules ~/.npm /root/.npm &&\
echo "=== npm install with verbose logging ===" &&\
npm install --legacy-peer-deps --no-audit --prefer-online --fetch-retries=3 --fetch-retry-mintimeout=20000 --fetch-retry-maxtimeout=120000 --loglevel=verbose &&\
echo "=== npm install ===" &&\
npm install --ignore-scripts --legacy-peer-deps --no-audit --prefer-online --fetch-retries=3 --fetch-retry-mintimeout=20000 --fetch-retry-maxtimeout=120000 &&\
echo "=== npm install completed ===" &&\
npm cache clean --force
@@ -36,24 +33,9 @@ COPY frontend/ ./
RUN npm run build
# Production stage - use temporary stage to install packages as root, then copy to unprivileged
FROM nginx:alpine AS runtime-builder
# Install runtime dependencies for canvas
RUN apk add --no-cache cairo pango jpeg libpng giflib
# Final production stage - unprivileged
# Production stage
FROM nginxinc/nginx-unprivileged:alpine
# Copy runtime libraries from runtime-builder
COPY --from=runtime-builder /usr/lib/libcairo.so.2 /usr/lib/
COPY --from=runtime-builder /usr/lib/libpango-1.0.so.0 /usr/lib/
COPY --from=runtime-builder /usr/lib/libpangocairo-1.0.so.0 /usr/lib/
COPY --from=runtime-builder /usr/lib/libpangoft2-1.0.so.0 /usr/lib/
COPY --from=runtime-builder /usr/lib/libpng16.so.16 /usr/lib/
COPY --from=runtime-builder /usr/lib/libgif.so.7 /usr/lib/
COPY --from=runtime-builder /usr/lib/libjpeg.so.8 /usr/lib/
ENV BACKEND_HOST=backend \
BACKEND_PORT=3001