Azure / dotnet-template-azure-iot-edge-module

Scaffolding tool for Azure IoT Edge C# module
MIT License
15 stars 23 forks source link

Install missing curl for debug dockerfiles #92

Closed dsschneidermann closed 11 months ago

dsschneidermann commented 1 year ago

To use RUN curl the layer must have curl installed first. When piping the result of a curl to bash, any errors from the first part is silently dropped, and in the end you produce a container that doesn't have the advertised feature.

dsschneidermann commented 1 year ago

@microsoft-github-policy-service agree

rido-min commented 11 months ago

you can always customize the docker files after the project has been generated from the template.

What's the use case of installing curl?

dsschneidermann commented 11 months ago

Oh, sorry that was not really clearly described. The problem fixed here is that the .debug Dockerfiles come with no debugging tools installed.

The problem is further obstructed by those Dockerfiles that pipe the result of a failing curl attempt into bash, which then doesn't fail the build for those files. But curl isn't installed, so in the end we end up deploying 'debug' versions that can't debug anything.

https://github.com/Azure/dotnet-template-azure-iot-edge-module/blob/49fa8756d0daed482080be7e65ec7172a2a8ef83/content/dotnet-template-azure-iot-edge-module/CSharp/Dockerfile.amd64.debug#L9

https://github.com/Azure/dotnet-template-azure-iot-edge-module/blob/49fa8756d0daed482080be7e65ec7172a2a8ef83/content/dotnet-template-azure-iot-edge-module/CSharp/Dockerfile.arm32v7.debug#L9

https://github.com/Azure/dotnet-template-azure-iot-edge-module/blob/49fa8756d0daed482080be7e65ec7172a2a8ef83/content/dotnet-template-azure-iot-edge-module/CSharp/Dockerfile.arm64v8.debug#L9

rido-min commented 11 months ago

I see.. however I think that method to debug containers is a bit outdated.

Visual Studio is able to acquire, deploy and use vsdbg automagically, see https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/ide/troubleshooting-docker-errors?view=vs-2022

@marianan this might be a good time to update the docker support in this template.

dsschneidermann commented 11 months ago

From https://learn.microsoft.com/en-us/azure/iot-edge/debug-module-vs-code

Debug a module with the IoT Edge runtime
In each module folder, there are several Docker files for different container types. Use any of the files that end with the extension .debug to build your module for testing.

The docs are suggesting that these files should work out of the box. We ran into the issue that it doesn't work without the debugger tools installed. This PR fixes that for other people who want to follow documentation and get stuff working.

dsschneidermann commented 11 months ago

Or I guess you can remove the files so that noone can follow the documentation. Okay, closing this.