fix(docker): use entrypoint to fix /app/data permissions on mounted volumes
This commit is contained in:
parent
9c757ff7d2
commit
8c51edabcf
1 changed files with 5 additions and 3 deletions
|
|
@ -23,11 +23,13 @@ COPY --from=builder /app/.next/static ./.next/static
|
||||||
COPY --from=builder /app/.next/standalone ./
|
COPY --from=builder /app/.next/standalone ./
|
||||||
COPY --from=builder /app/open-sse ./open-sse
|
COPY --from=builder /app/open-sse ./open-sse
|
||||||
|
|
||||||
# Runtime writable location for localDb — must be AFTER COPY to avoid permission overwrite
|
RUN mkdir -p /app/data
|
||||||
RUN mkdir -p /app/data && chown node:node /app/data
|
|
||||||
|
|
||||||
USER node
|
# Fix permissions at runtime (handles mounted volumes)
|
||||||
|
RUN printf '#!/bin/sh\nchown -R node:node /app/data 2>/dev/null; exec su-exec node "$@"\n' > /entrypoint.sh && chmod +x /entrypoint.sh
|
||||||
|
RUN apk add --no-cache su-exec
|
||||||
|
|
||||||
EXPOSE 20128
|
EXPOSE 20128
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue