Docker Community Forums

Share and learn in the Docker community.

Help Needed with Dockerizing Windows app to Docker (have Windows .exe file and static assets)


(Dragonosman) #1

I have a web app that I want to Dockerize (note: I need help in doing this because I’m new to Docker). You can read about it and see the source code on my GitHub page in this repo: https://github.com/DragonOsman/currency_converter . Basically, it’s a currency converter web app that uses Google Maps as the GUI. It requires the Google Maps API Key and the currencylayer.com currency API Access Key to work correctly. Those Keys are stored in environment variables declared in the backend code and passed to the frontend when needed.

The backend code is written in C++ and is also itself a web server. The frontend code consists of HTML, CSS and JavaScript static asset files (three files in total).

I already have a compiled executable that I got from building the C++ code in Visual Studio 2017 (a .exe file). I want to know how to write a Dockerfile to move that and the three static assets to Docker, and also write a command to make Docker set the environment variables if possible. If the .exe file won’t work, then I’ll need to know what commands to add to get the dependencies and build it directly on a VM image in Docker. I need to get Boost version 1.68.0 (for the Beast library and also Boost.System to link the code against), Jinja2Cpp (there’s a GitHub page), and Nlohmann.JSON (there’s a GitHub page).

I’d like to know how to have Docker get those files directly from the Web into the locations I want them in. Please see the #include lines in the C++ file and the lines in the HTML file where it’s bringing in the CSS and JavaScript files to see the locations.

I have Windows 10 Home, so I had to install Docker Toolbox. I have the latest version and build of the OS.

Edit: Okay, I found out that I can’t switch between Linux and Windows containers for Docker on Windows 10 Home edition. I’m downloading an evaluation version of Windows Server 2016 ISO for VirtualBox so I can install Docker CE for Windows there and then just Dockerize my application there.

I’ll still need to know how to write the Dockerfile for this app, though. Preferably for Dockerizing the existing Windows .exe file and the static assets. I also need to know how to set the environment variables for the executable app’s process inside the Docker image and also how to always have it run the executable (it’s a web server, so I need to have it be running at all times).

I’m also going to compile the app on the Bionic Beaver VM I have so I can create a Dockerfile for the executable and static assets on that Linux VM just in case I end up needing that (like if something would happen to the Docker image created from the Server 2016 eval copy after evaluation period is up (180 days) – would something happen to the image, or would it still be fine even after that?).