Introduction
In this article I will show you how to pack and release an app through docker on Windows system. This tutorial is based on the Samples from SDK for ctrlX AUTOMATION in three different languages (.net, python and C++).
In another tutorial I think you already know something about the ctrlX WORKS App Build Environment. This environment can usually only be configured on Linux systems or Linux virtual machine on Windows system. If you are a pure Windows follower, you can also actually package and publish app for your ctrlX Core.
Note that this tutorial does not cover the debugging of the app. If you want to learn how to debug an app, please move here.
Preparation (The version used for this tutorial)
Windows OS (Win11)
Visual Studio Code
Proxy (If necessary)
Docker Desktop (27.4.0)
Docker Image: ghcr.io/canonical/snapcraft:8_core22
ctrlx-datalayer (2.6.4)
ctrlX CORE or ctrlX CORE virtual (2.6.9)
Additional
If your computer can connect directly to the Internet, then you can skip this part.
If your computer needs a proxy (usually a company computer) to enable docker containers to Internet and download files, then I recommend to install and run px.exe as local proxy server on your Windows host.
Operation
Download the released SDK compressed package from GitHub and decompress it. For example, ctrlx-automation-sdk-2.6.7.zip
Released ctrlx-automation-sdk on github Download the snap build script compressed package and decompress it. There are scripts in three different languages (.net, python and C++) ββfor Windows.
Script overview Copy the script to the corresponding sample project. For example, you want to package a
.net
sample projectdatalayer.provider.alldata
under the Windows system. Then you can copy the script in this way:Win\Net\build-snap-dotnet.ps1
->ctrlx-automation-sdk\samples-net\datalayer.provider.alldata
Copy the script to the project root directory Open
Docker Desktop
and keep it running in the background. If you cannot run docker due toWSL
issues, you can try running the following command in the command window:bcdedit /set hypervisorlaunchtype auto
Open a command window in the project root. Then run the commend:
.\build-snap-dotnet.ps1
Run the script in the command window Notice: If you are not using a proxy, please remove these lines from the script.
-e http_proxy="http://host.docker.internal:3128" ` -e https_proxy="http://host.docker.internal:3128" `
Content that needs to be deleted if without proxy If you end up seeing something like this, congratulations! You can install the snap-App on your ctrlX CORE now.
The result of successful script execution Here is a brief explanation of how the script works (Take
.net
as an example). See the script for more details.Select the target device. (
amd64
orarm64
)Compile and publish
.net
program. (If you don't have a compiler installed on your computer, please go here)Check and modify the original
snapcraft.yaml
file.Download Image
ghcr.io/canonical/snapcraft:8_core22
in Docker.Run commend in Docker to package the published .net program into a snap file.
Summarize
.Net: The compilation, debugging, publishing and packaging of the program can be fully realized on Windows in Docker.
Python: The compilation and debugging of the program need to be completed in the ctrlx-sdk environment due to some dependencies on
ctrlx-datalayer
. No need to publish. The packaging process can be achieved under Windows in Docker.Cpp: The compilation, debugging, publishing need to be completed in the ctrlx-sdk environment due to some dependencies on
ctrlx-datalayer
. Only the packaging can be achieved under Windows in Docker.
debugging
release
packaging
.net
Yes
Yes
Yes
python
No
don't need
Yes
cpp
No
No
Yes