fix: add liberation fonts to Docker image and configure resvg to use them for label rendering
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s

This commit is contained in:
2026-05-08 09:36:55 +02:00
parent 658c6de74e
commit 2fbbe1142b
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ RUN npm run build
# Production
FROM node:20-alpine
RUN apk add --no-cache ghostscript imagemagick
RUN apk add --no-cache ghostscript imagemagick font-liberation fontconfig
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
@@ -89,7 +89,14 @@ export class LabelRendererService {
${parts.join('\n ')}
</svg>`;
const resvg = new Resvg(svg, { font: { loadSystemFonts: true } });
const resvg = new Resvg(svg, {
font: {
loadSystemFonts: true,
fontDirs: ['/usr/share/fonts', '/usr/local/share/fonts'],
defaultFontFamily: 'Liberation Sans',
sansSerifFamily: 'Liberation Sans',
},
});
return Buffer.from(resvg.render().asPng());
}
}