Conversation
Add .dockerignore file to exclude unnecessary files from Docker context
There was a problem hiding this comment.
Pull request overview
This PR adds Docker support for the servers/git FastAPI service so it can be built and run consistently like the other servers in the repo.
Changes:
- Updated
servers/git/requirements.txtto includeGitPython, matching the runtime dependency used inmain.py. - Added a Dockerfile for the git server, including Git installation, non-root user, dependency installation, and an
uvicornentrypoint. - Added a minimal
compose.yamland a.dockerignorealigned with patterns used by other servers in this repository.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
servers/git/requirements.txt |
Adds GitPython to match the git usage in main.py, ensuring the app has its required dependency in the container. |
servers/git/Dockerfile |
Defines a BuildKit-friendly Python 3.10 slim image with Git installed, installs requirements.txt, configures a non-root user, sets HOME for Git, and runs uvicorn main:app on port 8000. |
servers/git/compose.yaml |
Provides a simple compose service definition for the git server, building from the local context and exposing port 8000:8000, consistent with other servers. |
servers/git/.dockerignore |
Mirrors the ignore patterns used by other servers to keep the Docker build context lean and exclude repo metadata and docs from images. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RUN --mount=type=cache,target=/root/.cache/pip \ | ||
| --mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
| python -m pip install -r requirements.txt |
There was a problem hiding this comment.
python -m pip install -r requirements.txt installs third-party dependencies from PyPI without any version pinning or integrity guarantees, so each build may pull arbitrary new code from mutable package versions. If an attacker compromises one of these packages or the package index, they can achieve code execution in the build and runtime environment of this git server. To reduce supply chain risk, pin all external dependencies in requirements.txt to specific versions (or hashes) and use a reproducible, trusted source for installing them.
There was a problem hiding this comment.
This was a direct copy from the other examples in the repo.
Summary
This PR adds Docker support to the git server repo. I matched the other server's Dockerfile, minus a few tweaks to ensure git works.
Changes
I didn't update the README.md, but I'm happy to if you'd like.
Testing Checklist
docker-compose up.