Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Samples] Update IIS sample Dockerfile #5805

Merged
merged 6 commits into from
Jul 30, 2024

Conversation

lucaspimentel
Copy link
Member

@lucaspimentel lucaspimentel commented Jul 24, 2024

Summary of changes

Improve the Dockerfile used to install dd-trace-dotnet in the containerized IIS app sample in tracer/samples/IISInDocker.

Reason for change

A user reported having issues with the Dockerfile, and I was able to reproduce.

Implementation details

  • move install script to a separate ps1 file
  • use absolute paths for msi download and log file (this is the main reason for this PR, the relative paths fail in common scenarios)
  • use PowerShell's built-in Invoke-WebRequest instead of .NET's System.Net.WebClient.DownloadFile()
    (which is obsolete)
  • get the github release flagged as latest instead of the most recent (not the same thing! this would've downloaded preview versions of v3.x, for example)
  • add more verbosity in console messages (show url, download path, log path, etc) to ease troubleshooting
  • add basic .dockerignore file

Test coverage

Tested manually.

Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take your word for it, but I don't really understand why we need to make some of these changes 🤷‍♂️

# Note: Normally an IIS reset is also required but 'C:\ServiceMonitor.exe w3svc'
# will restart IIS and update the environment variables received by the child w3wp processes
RUN Write-Host 'Determining latest release' ;\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this can't be done here and instead has to be moved to a file? 🤔 I don't know of a good reason it needs to be?

Copy link
Member Author

@lucaspimentel lucaspimentel Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Level of care low on this one, but I can think of a few very "mild" reasons 😅

  • If a script is going to be more than a handful of lines, I think it deserves its own file (cleaner code, separation of concerns, etc)
  • This particular script is not Docker-specific. A separate file makes it easier to copy and use elsewhere.
  • It definitely made it easier and faster for me to fix it outside of Docker. (probably the main reason I did it)

tracer/samples/IISInDocker/Dockerfile Outdated Show resolved Hide resolved
@lucaspimentel lucaspimentel merged commit 3d5029c into master Jul 30, 2024
91 of 93 checks passed
@lucaspimentel lucaspimentel deleted the lpimentel/iis-docker-sample branch July 30, 2024 14:21
@github-actions github-actions bot added this to the vNext-v3 milestone Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants