Skip to content

Commit 7a95c3c

Browse files
committed
Run container as non-root user for security
Addresses security finding by adding dedicated agentmemory user. Prevents privilege escalation if container is compromised.
1 parent 4eb4bdf commit 7a95c3c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ ADD . /app
3232
RUN --mount=type=cache,target=/root/.cache/uv \
3333
uv sync --frozen --no-dev
3434

35+
# Create non-root user for security
36+
RUN groupadd -r agentmemory && useradd -r -g agentmemory agentmemory && \
37+
chown -R agentmemory:agentmemory /app
38+
3539
ENV PATH="/app/.venv/bin:$PATH"
3640

41+
# Switch to non-root user
42+
USER agentmemory
43+
3744
ENTRYPOINT []
3845

3946
EXPOSE 8000

0 commit comments

Comments
 (0)