Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN TREK_TAG=$(fetch -qo - "${UPSTREAM_URL}" | jq -r .tag_name) && \
RUN cd /build && \
NODE_ENV=development npm ci && \
npm run build --workspace=shared && \
npm run build --workspace=server && \
cd client && \
for spec in apple-touch-icon-180x180.png:180 icon-192x192.png:192 icon-512x512.png:512; do \
name=${spec%:*}; size=${spec#*:}; \
Expand Down Expand Up @@ -92,7 +93,8 @@ ENV NODE_ENV=production \
PORT=3000

COPY root/ /
RUN chmod +x /etc/services.d/trek/run /healthz
RUN chmod +x /etc/services.d/trek/run /healthz && \
chmod 0644 /usr/local/share/trek/dom-polyfill.cjs

EXPOSE 3000
VOLUME /config
4 changes: 3 additions & 1 deletion Containerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN TREK_TAG=$(fetch -qo - "${UPSTREAM_URL}" | jq -r .tag_name) && \
RUN cd /build && \
NODE_ENV=development npm ci && \
npm run build --workspace=shared && \
npm run build --workspace=server && \
cd client && \
for spec in apple-touch-icon-180x180.png:180 icon-192x192.png:192 icon-512x512.png:512; do \
name=${spec%:*}; size=${spec#*:}; \
Expand Down Expand Up @@ -86,7 +87,8 @@ ENV NODE_ENV=production \
PORT=3000

COPY root/ /
RUN chmod +x /etc/services.d/trek/run /healthz
RUN chmod +x /etc/services.d/trek/run /healthz && \
chmod 0644 /usr/local/share/trek/dom-polyfill.cjs

EXPOSE 3000
VOLUME /config
1 change: 0 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ services:
container_name: trek
restart: unless-stopped


environment:
- PUID=1000
- PGID=1000
Expand Down
4 changes: 3 additions & 1 deletion root/etc/services.d/trek/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export PORT=3000
# Signal readiness to CIT once the API answers
s6-ready-when fetch -qo /dev/null http://localhost:3000/api/health

exec /usr/local/bin/s6-setuidgid bsd /usr/local/bin/node --import tsx src/index.ts
exec /usr/local/bin/s6-setuidgid bsd /usr/local/bin/node \
--require /usr/local/share/trek/dom-polyfill.cjs \
--require tsconfig-paths/register dist/index.js
9 changes: 9 additions & 0 deletions root/usr/local/share/trek/dom-polyfill.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Canvas globals for pdf.js (bundled by pdf-parse). FreeBSD has no
// @napi-rs/canvas native binding, so these are otherwise undefined and
// pdf-parse throws "DOMMatrix is not defined" at import, crashing boot.
if (typeof globalThis.DOMMatrix === 'undefined')
globalThis.DOMMatrix = class DOMMatrix { constructor(){ this.a=1;this.b=0;this.c=0;this.d=1;this.e=0;this.f=0; } };
if (typeof globalThis.ImageData === 'undefined')
globalThis.ImageData = class ImageData { constructor(w,h){ this.width=w;this.height=h; } };
if (typeof globalThis.Path2D === 'undefined')
globalThis.Path2D = class Path2D {};