🚀 𝗧𝘂𝗿𝗻𝗶𝗻𝗴 𝗮 .𝗡𝗘𝗧 𝗖𝗟𝗜 𝘁𝗼𝗼𝗹 𝗶𝗻𝘁𝗼 𝗮 𝗡𝗼𝗱𝗲.𝗷𝘀 𝘀𝗲𝗿𝘃𝗶𝗰𝗲 I recently faced a tricky challenge: transforming a complex .NET CLI app, built to parse a proprietary binary protocol, into a more flexible solution. It's powerful but, in fact, locked to Windows. Rewriting it from scratch wasn't an option, and the pre-built self-contained version wouldn't run on Mac (my host system) without modifying the source code – something I'd like to avoid. 🎯 I wanted to make it accessible to other backends, like Node.js, and turn it into a self-hosted service. 𝗛𝗲𝗿𝗲'𝘀 𝘄𝗵𝗮𝘁 𝗜 𝗱𝗶𝗱: • Created a multistage Dockerfile to containerize the CLI, making it platform-agnostic • Built a lightweight Node.js server to wrap the CLI's output and expose its functionality via a REST API • Added docker-compose configs both for prod and dev (with hot reloading) • Implemented a smart build process to skip rebuilding the CLI app when only the Node.js server code changes • Tested this setup on fly(dot)io and render(dot)com – both ran the container smoothly on their free tiers with limited resources • Added a simple web playground for testing 𝗧𝗵𝗲 𝗥𝗲𝘀𝘂𝗹𝘁: • The CLI is now a portable service I can deploy anywhere containers are supported • No dependency on .NET runtime on the host • A thin REST api layer for interaction It's not rocket science, but it shows how even complex desktop-oriented tools can be repurposed as lightweight services with very little glue code. I leave a link to the source code in the comments to let you explore the result. ✍️ How do you find this approach? #DevOps #Containerization #REST #SoftwareEngineering
what part of this flimsy barn with the .Net BMW inside is "more flexible solution"? Convert it to .Net Core and run on linux if you so wish: https://blog.matrixpost.net/run-a-net-core-console-app-on-ubuntu/
CLIs are built with other more capable languages lad
This is a really clever approach! I love how you made a platform-specific CLI portable with minimal changes and added a REST layer on top. Containerizing tricky tools like this is such a smart way to make them accessible across environments. I’m curious did you run into any performance or resource constraints when wrapping the CLI in Node.js?
This is a fantastic and very practical solution to a common problem. The approach of using a Dockerfile to containerize the .NET CLI and wrapping it with a Node.js REST API is brilliant. It perfectly bridges the gap between a legacy tool and modern, scalable architecture.
Software Engineer | Senior Frontend Developer | TypeScript, React, Next.js, LLM | Performance & DX | 12+ YoE | Remote EU | B2B
1moSource: https://github.com/likerRr/gw2-elite-insights-node