From 61418c6f771eb150566b48e702f4338933f3ae33 Mon Sep 17 00:00:00 2001 From: MasutaYunikon Date: Tue, 10 Mar 2026 23:51:50 +0100 Subject: [PATCH] fix: add user permissions when the scripts is launched --- Dockerfile | 10 +++++++--- entrypoint.sh | 12 ++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index a4277ef..e4fa2ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,13 +15,17 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN pnpm run build # ── Production ───────────────────────────────────────────────── -FROM base +FROM node:20-slim +RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/* + +WORKDIR /app COPY --from=prod-deps /app/node_modules /app/node_modules COPY --from=build /app/dist/server /app/dist/server COPY --from=build /app/dist/client /app/public - +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh RUN mkdir -p /app/data EXPOSE 3001 ENV NODE_ENV=production -CMD ["node", "dist/server/index.js"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..2f1e925 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +PUID=${PUID:-1000} +PGID=${PGID:-1000} + +echo "[fankarr] Running as UID=${PUID} GID=${PGID}" + +# Corriger les permissions du dossier data +chown -R "$PUID:$PGID" /app/data + +exec gosu fankarr node dist/server/index.js \ No newline at end of file