mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-15 11:21:57 +00:00
fix: Install canvas build dependencies to make trianglify work
Canvas requires native build tools to compile: - python3: For node-gyp - make, g++, pkgconfig: C++ compiler and build tools - cairo-dev, jpeg-dev, pango-dev, giflib-dev: Native libraries By installing these dependencies before npm install, canvas can properly build its native bindings for both AMD64 and ARM64 architectures. Removed try-catch blocks around trianglify since it should now work properly.
This commit is contained in:
@@ -17,15 +17,16 @@ CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000"]
|
|||||||
# Builder stage for production
|
# Builder stage for production
|
||||||
FROM node:lts-alpine AS builder
|
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
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
COPY frontend/package*.json ./
|
COPY frontend/package*.json ./
|
||||||
|
|
||||||
RUN npm cache clean --force &&\
|
RUN npm cache clean --force &&\
|
||||||
rm -rf node_modules ~/.npm /root/.npm &&\
|
rm -rf node_modules ~/.npm /root/.npm &&\
|
||||||
npm install --legacy-peer-deps --no-audit --prefer-online --fetch-retries=3 --fetch-retry-mintimeout=20000 --fetch-retry-maxtimeout=120000 --ignore-scripts &&\
|
npm install --legacy-peer-deps --no-audit --prefer-online --fetch-retries=3 --fetch-retry-mintimeout=20000 --fetch-retry-maxtimeout=120000
|
||||||
echo "package.json" > node_modules/.gitignore &&\
|
|
||||||
echo "Express cors and trianglify are not needed in production build" || true
|
|
||||||
|
|
||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ const Layout = ({ children }) => {
|
|||||||
themeConfig?.login &&
|
themeConfig?.login &&
|
||||||
document.documentElement.classList.contains("dark")
|
document.documentElement.classList.contains("dark")
|
||||||
) {
|
) {
|
||||||
try {
|
|
||||||
// Get current date as seed for daily variation
|
// Get current date as seed for daily variation
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dateSeed = `${today.getFullYear()}-${today.getMonth()}-${today.getDate()}`;
|
const dateSeed = `${today.getFullYear()}-${today.getMonth()}-${today.getDate()}`;
|
||||||
@@ -263,10 +262,6 @@ const Layout = ({ children }) => {
|
|||||||
|
|
||||||
// Render to canvas
|
// Render to canvas
|
||||||
pattern.toCanvas(bgCanvasRef.current);
|
pattern.toCanvas(bgCanvasRef.current);
|
||||||
} catch (error) {
|
|
||||||
// Silently fail if trianglify/canvas is not available
|
|
||||||
console.debug("Trianglify background not available:", error.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ const Login = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const generateBackground = () => {
|
const generateBackground = () => {
|
||||||
if (canvasRef.current && themeConfig?.login) {
|
if (canvasRef.current && themeConfig?.login) {
|
||||||
try {
|
|
||||||
// Get current date as seed for daily variation
|
// Get current date as seed for daily variation
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dateSeed = `${today.getFullYear()}-${today.getMonth()}-${today.getDate()}`;
|
const dateSeed = `${today.getFullYear()}-${today.getMonth()}-${today.getDate()}`;
|
||||||
@@ -79,10 +78,6 @@ const Login = () => {
|
|||||||
|
|
||||||
// Render to canvas
|
// Render to canvas
|
||||||
pattern.toCanvas(canvasRef.current);
|
pattern.toCanvas(canvasRef.current);
|
||||||
} catch (error) {
|
|
||||||
// Silently fail if trianglify/canvas is not available
|
|
||||||
console.debug("Trianglify background not available:", error.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user