-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add docker compose support #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
897d1b8
4c1fd66
fec256b
255c99f
8c2f222
f03c448
4dfb828
29588c5
a0d1fd2
287e2de
bd49293
17651a9
afe0153
d4008b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Git | ||
| .git | ||
| .gitignore | ||
|
|
||
| # Python | ||
| __pycache__ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| .env | ||
| .venv | ||
| env/ | ||
| venv/ | ||
| ENV/ | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Build | ||
| *.egg-info/ | ||
| dist/ | ||
| build/ | ||
| .eggs/ | ||
|
|
||
| # Logs (will be mounted as volume) | ||
| logs/ | ||
|
|
||
| # OAuth credentials (will be mounted as volume) | ||
| oauth_creds/ | ||
|
|
||
| # Documentation | ||
| *.md | ||
| !README.md | ||
|
|
||
| # GitHub | ||
| .github/ | ||
|
|
||
| # Misc | ||
| .DS_Store | ||
| *.log |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||||||||||||||
| # Build stage | ||||||||||||||||||||||
| FROM python:3.11-slim as builder | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Install build dependencies | ||||||||||||||||||||||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||||||||||||||||||
| gcc \ | ||||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Copy requirements first for better caching | ||||||||||||||||||||||
| COPY requirements.txt . | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Copy the local rotator_library for editable install | ||||||||||||||||||||||
| COPY src/rotator_library ./src/rotator_library | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Install dependencies | ||||||||||||||||||||||
| RUN pip install --no-cache-dir --user -r requirements.txt | ||||||||||||||||||||||
|
Comment on lines
+14
to
+18
|
||||||||||||||||||||||
| # Copy the local rotator_library for editable install | |
| COPY src/rotator_library ./src/rotator_library | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Copy the local rotator_library for installation | |
| COPY src/rotator_library ./src/rotator_library | |
| # Install dependencies (requirements.txt should NOT include -e src/rotator_library) | |
| RUN pip install --no-cache-dir --user -r requirements.txt && pip install --no-cache-dir --user ./src/rotator_library |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The container is configured to run as the default root user (FROM python:3.11-slim with dependencies installed under /root/.local and no USER directive), which means any remote code execution in proxy_app would immediately yield root-level access inside the container and to any mounted volumes (e.g., OAuth credentials). To reduce impact from a compromise, create a dedicated non-root user, install dependencies into that user’s home, set ownership on /app, logs, and oauth_creds, and add a USER directive so the app runs with least privilege. For example:
RUN useradd -m appuser \
&& chown -R appuser:appuser /app
USER appuserand adjust install paths accordingly.
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Port mismatch: The EXPOSE instruction specifies port 8317, but the CMD at line 46 uses port 8000. This should be 8000 to match the application's default port and the docker-compose.yml configuration.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||
| services: | ||||||||||
|
||||||||||
| llm-proxy: | ||||||||||
| build: | ||||||||||
| context: . | ||||||||||
| dockerfile: Dockerfile | ||||||||||
| container_name: llm-api-proxy | ||||||||||
| restart: unless-stopped | ||||||||||
| ports: | ||||||||||
| - "8317:8317" | ||||||||||
| volumes: | ||||||||||
| # Mount .env files for configuration | ||||||||||
|
||||||||||
| # Mount .env files for configuration | |
| # Mount .env files for configuration | |
| # NOTE: You must create a .env file on the host before running docker-compose. | |
| # Copy or rename .env.example to .env and update values as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider pinning the gcc version or using
build-essentialfor more complete build dependencies. Whilegccalone works for most Python packages, some might need additional build tools. For example:build-essentialorgcc g++for C++ extensions.