fix: redirect ~/.9router to DATA_DIR in Docker to persist usage data across updates (closes #585) (#658)

This commit is contained in:
Anurag Saxena
2026-05-03 04:18:06 -04:00
committed by GitHub
parent 52ad3b6630
commit e1c092c297
2 changed files with 7 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ ENV NODE_ENV=production
ENV PORT=20128
ENV HOSTNAME=0.0.0.0
ENV NEXT_TELEMETRY_DISABLED=1
ENV DATA_DIR=/app/data
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/static ./.next/static
@@ -34,11 +35,13 @@ COPY --from=builder /app/src/mitm ./src/mitm
# Standalone node_modules may omit deps only required by the MITM child process.
COPY --from=builder /app/node_modules/node-forge ./node_modules/node-forge
RUN mkdir -p /app/data && chown -R bun:bun /app
RUN mkdir -p /app/data && chown -R bun:bun /app && \
mkdir -p /app/data-home && chown bun:bun /app/data-home && \
ln -sf /app/data-home /root/.9router 2>/dev/null || true
# Fix permissions at runtime (handles mounted volumes)
RUN apk --no-cache upgrade && apk --no-cache add su-exec && \
printf '#!/bin/sh\nchown -R bun:bun /app/data 2>/dev/null\nexec su-exec bun "$@"\n' > /entrypoint.sh && \
printf '#!/bin/sh\nchown -R bun:bun /app/data /app/data-home 2>/dev/null\nexec su-exec bun "$@"\n' > /entrypoint.sh && \
chmod +x /entrypoint.sh
EXPOSE 20128