diff --git a/src/fetch/Dockerfile b/src/fetch/Dockerfile index d2a4504931..ff59e89dc1 100644 --- a/src/fetch/Dockerfile +++ b/src/fetch/Dockerfile @@ -23,6 +23,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \ FROM python:3.12-slim-bookworm +RUN if ! id -u app >/dev/null 2>&1; then useradd -rUM -s /usr/sbin/nologin app; fi + WORKDIR /app COPY --from=uv /root/.local /root/.local @@ -32,6 +34,8 @@ RUN if ! id -u app >/dev/null 2>&1; then \ fi COPY --from=uv --chown=app:app /app/.venv /app/.venv +USER app + # Place executables in the environment at the front of the path ENV PATH="/app/.venv/bin:$PATH" diff --git a/src/filesystem/Dockerfile b/src/filesystem/Dockerfile index 418b140056..c8d3e0caeb 100644 --- a/src/filesystem/Dockerfile +++ b/src/filesystem/Dockerfile @@ -22,4 +22,6 @@ ENV NODE_ENV=production RUN npm ci --ignore-scripts --omit-dev +USER node + ENTRYPOINT ["node", "/app/dist/index.js"] \ No newline at end of file diff --git a/src/git/Dockerfile b/src/git/Dockerfile index 4af41612c7..89dfce9657 100644 --- a/src/git/Dockerfile +++ b/src/git/Dockerfile @@ -26,6 +26,8 @@ FROM python:3.12-slim-bookworm RUN apt-get update && apt-get install -y git git-lfs && rm -rf /var/lib/apt/lists/* \ && git lfs install --system +RUN if ! id -u app >/dev/null 2>&1; then useradd -rUM -s /usr/sbin/nologin app; fi + WORKDIR /app COPY --from=uv /root/.local /root/.local @@ -35,6 +37,8 @@ RUN if ! id -u app >/dev/null 2>&1; then \ fi COPY --from=uv --chown=app:app /app/.venv /app/.venv +USER app + # Place executables in the environment at the front of the path ENV PATH="/app/.venv/bin:$PATH" diff --git a/src/memory/Dockerfile b/src/memory/Dockerfile index 2f85d0cfa2..da974629f3 100644 --- a/src/memory/Dockerfile +++ b/src/memory/Dockerfile @@ -21,4 +21,6 @@ WORKDIR /app RUN npm ci --ignore-scripts --omit-dev +USER node + ENTRYPOINT ["node", "dist/index.js"] \ No newline at end of file diff --git a/src/time/Dockerfile b/src/time/Dockerfile index c92873277d..8cad1f6425 100644 --- a/src/time/Dockerfile +++ b/src/time/Dockerfile @@ -23,6 +23,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \ FROM python:3.12-slim-bookworm +RUN if ! id -u app >/dev/null 2>&1; then useradd -rUM -s /usr/sbin/nologin app; fi + WORKDIR /app COPY --from=uv /root/.local /root/.local @@ -32,6 +34,8 @@ RUN if ! id -u app >/dev/null 2>&1; then \ fi COPY --from=uv --chown=app:app /app/.venv /app/.venv +USER app + # Place executables in the environment at the front of the path ENV PATH="/app/.venv/bin:$PATH"