Skip to content

Commit c54422e

Browse files
Merge pull request #19 from LuNHans/feature/dockerfile-non-root
fix: run Docker container as non-root user to reduce blast radius
2 parents bd3e10f + 7dc102e commit c54422e

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y \
77
build-essential \
88
&& rm -rf /var/lib/apt/lists/*
99

10+
RUN useradd -m mcpuser
1011
# Set working directory
1112
WORKDIR /app
1213

@@ -19,7 +20,8 @@ COPY src/ ./src/
1920

2021
# Set environment variables
2122
ENV PYTHONPATH=/app
23+
ENV P4TICKETS=/home/mcpuser/.p4tickets
2224

2325
# Run the server
2426
ENTRYPOINT ["python3", "-m", "src.main"]
25-
CMD ["--transport", "stdio"]
27+
CMD ["--transport", "stdio"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Add the following to your `mcp.json`:
131131
"-e", "P4PORT=ssl:perforce.example.com:1666",
132132
"-e", "P4USER=your_username",
133133
"-e", "P4CLIENT=your_workspace",
134-
"-v", "/Users/your_username/.p4tickets:/root/.p4tickets:ro",
134+
"-v", "/Users/your_username/.p4tickets:/home/mcpuser/.p4tickets:ro",
135135
"p4-mcp-server"
136136
]
137137
}
@@ -156,7 +156,7 @@ Add the following to your `mcp.json`:
156156
Using P4 tickets:
157157
```bash
158158
# macOS/Linux
159-
-v /Users/your_username/.p4tickets:/root/.p4tickets:ro
159+
-v /Users/your_username/.p4tickets:/home/mcpuser/.p4tickets:ro
160160
```
161161

162162
> **Note:** Use the full path to your tickets file (not `~`). After running `p4 login`, restart the MCP server to pick up the new ticket.
@@ -203,7 +203,7 @@ Example configuration with client root mounted:
203203
"-e", "P4PORT=ssl:perforce.example.com:1666",
204204
"-e", "P4USER=your_username",
205205
"-e", "P4CLIENT=your_workspace",
206-
"-v", "/Users/your_username/.p4tickets:/root/.p4tickets",
206+
"-v", "/Users/your_username/.p4tickets:/home/mcpuser/.p4tickets",
207207
"-v", "/path/to/client/root:/path/to/client/root",
208208
"p4-mcp-server"
209209
]

0 commit comments

Comments
 (0)