Feat/Run Docker container as non-root user for Kubernetes PSP/PSA compatibility (#1)

* Initial plan

* Add non-root user support to Dockerfile

Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>

* Add SECURITY.md documentation

Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>

* Add Kubernetes example manifest, verification script, and README updates

Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>

* Remove documentation changes (SECURITY.md, k8s-example.yaml, verify script, README updates)

Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>
This commit is contained in:
Copilotandtheepicsaxguy authored and GitHub committed 2025-12-02 23:56:19 +01:00
1 parent 8acd0da5cb
commit d97735c956
2 files changed
+21 -5

No files matched your search

+20 -5
View File
@@ -20,8 +20,15 @@ RUN apt-get update && apt-get install -y \
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
RUN curl -fsSL https://bun.sh/install | bash && \
ln -s $HOME/.bun/bin/bun /usr/local/bin/bun
USER node
RUN mkdir -p /home/node/.local/bin && \
curl -fsSL https://bun.sh/install | bash && \
ln -s /home/node/.bun/bin/bun /home/node/.local/bin/bun
USER root
ENV PATH="/home/node/.local/bin:/home/node/.bun/bin:${PATH}"
WORKDIR /app
@@ -47,8 +54,13 @@ RUN pnpm --filter frontend build
FROM base AS runner
RUN curl -fsSL https://opencode.ai/install | bash && \
ln -s $HOME/.opencode/bin/opencode /usr/local/bin/opencode
USER node
RUN mkdir -p /home/node/.local/bin && \
curl -fsSL https://opencode.ai/install | bash && \
ln -s /home/node/.opencode/bin/opencode /home/node/.local/bin/opencode
USER root
ENV NODE_ENV=production
ENV HOST=0.0.0.0
@@ -69,7 +81,10 @@ RUN mkdir -p /app/backend/node_modules/@opencode-webui && \
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
RUN mkdir -p /workspace /app/data
RUN mkdir -p /workspace /app/data && \
chown -R node:node /workspace /app/data /app
USER node
EXPOSE 5003
+1
View File
@@ -1,6 +1,7 @@
#!/bin/bash
set -e
export HOME=/home/node
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:$HOME/.local/bin:$PATH"