How to run Delphi apps on Docker Linux with RadStudio 10.3.3 by Jarufaza

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,438
Credits
573
How to run Delphi apps on Docker Linux with RadStudio 10.3.3
17/12/2019 - JARUZAFA
[SHOWTOGROUPS=4,20]
At last, Embarcadero has released some oficial Docker images to run Delphi apps. Another good news is that you will be able to debug linux applications running in a container.

As you know, since RadStudio 10.2 you can target Linux for Delphi applications. Two years ago I wrote about how to run those Для просмотра ссылки Войди или Зарегистрируйся. But with the official images is easier!

Step by step
You need Для просмотра ссылки Войди или Зарегистрируйся or a docker server elesewhere. For this tutorial I’ll assume that you’ll use Docker for Windows, as it is the typical development setup.

Fire up a powershell and run:
> docker pull radstudio/paserver
> docker run -it -e PA_SERVER_PASSWORD=pass -p 64211:64211 -p 8082:8082 radstudio/paserver

Now you have PAServer running on a linux container. The password is “pass”, and the port to connect to is 64211.
The next step is to connect the RadStudio IDE to your docker container.

Create a new console application and add Linux 64 as target platform. Right-click on Linux 64 platform and select “Properties…”:

2019-12-15-09_35_44-Project3-Delphi-10.3-Project3.dproj_.png


At SDK combo select “Add New…”:

Add new SDK


At “Select a profile to connect”, choose “Add New…”:

2019-12-15-09_36_08-Project3-Delphi-10.3-Project3.dproj_.png


Give it a descriptive name like “paserver4docker”:

Create Connection Profile


Fill the “Remote machine field” with your container IP. If you are using Docker for Windows use “localhost” as the 64211 port is mapped to your container. Password for this example is “pass”:

Connection profile


Click on “Test Connection” and “Finish”. It will download a bunch of SDK files, and you’re almost done:

Platform properties


Click Ok, and run your project. In this example I’ve run a simple “Hello from Docker!” console application.

Hello world from Docker container


Another interesting feature is debugging your code running in a container. Just set a breakpoint and run your program. You can perform the usual debug actions like run step-by-step, inspect variables, set breakpoints, …

Debug session with Docker Linux


Final words
This was a long-waited feature since RadStudio Tokyo release. Embarcadero should improve the IDE integration with Docker for both Windows and Linux, as other popular IDE’s are doing for a long time

If you are curious, Embarcadero has released a set of Docker images with RadServer too. You can find them at: Для просмотра ссылки Войди или Зарегистрируйся

[/SHOWTOGROUPS]