Use GitHub to change how your NAV on Docker container works

14. January 2018

Use GitHub to change how your NAV on Docker container works

With the addition of the new “folder” feature in the NAV Docker images it is now possible to download a .zip in the very beginning of container startup and extract it to a folder. That allows you to make changes to the container logic in about every aspect without the need to map a local folder (which might not be possible or at least difficult as in e.g. Azure Container Instances). But to use that feature, you need to make your scripts available as a .zip for download. You might have access to some kind of a WebServer or can set one up, but then you still need to zip your changes and put them on that server when you make changes. And for others to conveniently look at your code, they would need to download and extract as well. Fortunately GitHub has a nice feature, of which Freddy Kristiansen made me aware: You can download a branch of a GitHub repo as a .zip file. Without that, this whole idea wouldn’t work, so all credit to Freddy (once again…)!

To give you an example of how that works, check my GitHub repo for some NAV on Docker samples, e.g. the branch for API initialization: You can easily grab a .zip of that with, e.g. Inside of that .zip you will have a root folder of the format repo-branch, e.g. nav-docker-samples-initialize-api. But you can give the folders param a subfolder, that the scripts then will use, so we can put the following in a docker run and it will download the zip and just move that subfolder to c:\run\my in the container

-e folders="c:\run\my=\nav-docker-samples-initialize-api"

With that, everyone can check your code through the GitHub pages and then use it by just putting it in the env param!

Leave a Reply

Your email address will not be published. Required fields are marked *