Add docker file and build action for it - #4
Open
Mih4n wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds containerization + CI automation for building/publishing a Docker image, and also introduces runtime changes to improve startup behavior (working directory detection) and stop/shutdown handling.
Changes:
- Add Docker build/publish assets (Dockerfile, compose, dockerignore) and a GitHub Actions workflow to publish images to GHCR.
- Add Nix development environment definitions (shell.nix + flake).
- Update ProxyPass runtime behavior: set working directory at startup, adjust console buffering, improve upstream connection logs, and add stop/signal handling.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ProxyPass.hpp | Adds stop-related synchronization members and new method declarations (requestStop / setWorkingDirectory). |
| src/ProxyPass.cpp | Implements working directory setup, console buffering, improved upstream logs, and new stop/signal + input handling logic. |
| src/Main.cpp | Calls ProxyPass::setWorkingDirectory() at startup. |
| shell.nix | Adds a Nix shell for building the project. |
| flake.nix | Adds a Nix flake-based dev shell. |
| flake.lock | Locks nixpkgs input for the flake. |
| Dockerfile | Adds a multi-stage Docker build (builder + slim runtime image). |
| docker-compose.yml | Adds a simple compose service for running the proxy container. |
| .gitignore | Ignores the .vscode directory. |
| .github/workflows/publishDocker.yml | Adds workflow to build and publish a Docker image to GHCR. |
| .dockerignore | Adds a build-context ignore list for Docker builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+51
| namespace { | ||
| std::atomic<ProxyPass*> gProxyPassInstance{nullptr}; | ||
|
|
||
| void proxyPassSignalHandler(int /*signum*/) { | ||
| if (auto* instance = gProxyPassInstance.load(std::memory_order_acquire)) { | ||
| instance->requestStop(); | ||
| } | ||
| } |
Comment on lines
+697
to
+710
| std::thread inputThread([this]() { | ||
| std::string command{}; | ||
| while (std::cin >> command) { | ||
| if (command == "stop") { | ||
| requestStop(); | ||
| break; | ||
| } | ||
| getLogger().error( | ||
| "Unknown command: {}. Please check that the command exists and that you have permission to use it.", | ||
| command | ||
| ); | ||
| } | ||
| getLogger().error( | ||
| "Unknown command: {}. Please check that the command exists and that you have permission to use it.", | ||
| command | ||
| ); | ||
| }); | ||
| inputThread.detach(); |
Comment on lines
+73
to
+82
| auto dir = exePath.parent_path(); | ||
| for (int i = 0; i < 4 && !dir.empty(); ++i) { | ||
| if (std::filesystem::exists(dir / "proxy_settings.jsonc")) { | ||
| std::filesystem::current_path(dir); | ||
| return; | ||
| } | ||
| dir = dir.parent_path(); | ||
| } | ||
| std::filesystem::current_path(exePath.parent_path()); | ||
| } |
Comment on lines
+59
to
+62
| # Docker | ||
| Dockerfile | ||
| .dockerignore | ||
| docker-compose.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.