Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

Commit 7667258

Browse files
koki-developclaude
andcommitted
Allow customization of API server user via build arg
Add API_USER build argument to Dockerfile so the API server execution user can be customized at build time instead of being hardcoded as 'piston'. This helps users who want to self-host without exposing the 'piston' name. Default remains 'piston' for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9ec5aab commit 7667258

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

api/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt-get update && \
1010

1111
FROM node:20.19.6-bookworm-slim@sha256:a270640213033657548b7ed57852709a0d2ee3b277f902f912367216aa8e9520
1212

13+
ARG API_USER=piston
1314
ENV DEBIAN_FRONTEND=noninteractive
1415

1516
RUN dpkg-reconfigure -p critical dash
@@ -21,7 +22,8 @@ RUN apt-get update && \
2122
libfftw3-dev libglpk-dev libqhull-dev libqrupdate-dev libsuitesparse-dev \
2223
libsundials-dev libpcre2-dev libcap-dev && \
2324
rm -rf /var/lib/apt/lists/*
24-
RUN useradd -M piston
25+
RUN useradd -M ${API_USER}
26+
ENV API_USER=${API_USER}
2527
COPY --from=isolate /usr/local/bin/isolate /usr/local/bin
2628
COPY --from=isolate /usr/local/etc/isolate /usr/local/etc/isolate
2729

api/src/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ mkdir init && \
2525
echo 1 > init/cgroup.procs && \
2626
echo '+cpuset +memory' > cgroup.subtree_control && \
2727
echo "Initialized cgroup" && \
28-
chown -R piston:piston /piston && \
29-
exec su -- piston -c 'ulimit -n 65536 && node /piston_api/src'
28+
chown -R "${API_USER}:${API_USER}" /piston && \
29+
exec su -- "${API_USER}" -c 'ulimit -n 65536 && node /piston_api/src'

0 commit comments

Comments
 (0)