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

Fix docker build script #213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix docker build script #213

wants to merge 2 commits into from

Conversation

Deliay
Copy link

@Deliay Deliay commented Jun 13, 2024

I tried to build a Docker image of NetPad, but it failed. I fixed the Dockerfile and then incidentally upgraded .NET to 8.0 and also upgraded most of the NetPad dependencies to the latest version.

This pull request includes these changes:

  • Bump .NET to 8.0 and bump almost dependencies to latest version
  • Fix & enhance docker build script
  • Support launching the OmniSharp server by dotnet exec OmniSharp.dll due to the container limitation

@tareqimbasher
Copy link
Owner

Thank you @Deliay. A rather large refactor is under way on the solution-refactor branch, including the upgrade to .NET 8. I will hold off on this PR until that is concluded, in a week or so, since it makes large sweeping changes. Once that's done I will revisit the changes introduced here and let you know.

Thanks for the work on the docker script, I haven't really maintained it at all. I appreciate the contribution.

@tareqimbasher
Copy link
Owner

Update: PR #211 is merged into main. I will be reviewing the changes here soon to see how it needs to change

@@ -1,5 +1,5 @@
{
"Urls": "http://localhost:57940",
"Urls": "http://0.0.0.0:57940",
Copy link
Owner

Choose a reason for hiding this comment

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

Binding to 0.0.0.0 here is a security risk if the machine running NetPad is exposed to an untrusted network. Instead we can have the docker script create an appsettings.Local.json that overrides that setting and sets it to 0.0.0.0. NetPad will use a appsettings.Local.json file if one exists.

@@ -1,5 +1,5 @@
{
"Urls": "http://localhost:57930",
"Urls": "http://0.0.0.0:57930",
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above

README.md Outdated
FROM netpad
RUN apk add dotnet6-sdk
RUN wget .... | bash -c
RUN ...
Copy link
Owner

Choose a reason for hiding this comment

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

Lines 284 and 285 seem incomplete (ie. ...)?

<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" Condition="'$(SKIP_SPA_BUILD)' != 'true' "/>
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" Condition=" '$(SKIP_SPA_BUILD)' != 'true' And '$(TARGET)' != 'web' " />
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we not want this when TARGET is web?

Copy link
Author

Choose a reason for hiding this comment

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

The frontend project has been built ahead in docker script, so we need to skip it when running the MSBuild target.


if (!string.IsNullOrWhiteSpace(additionalArgs))
args += " " + additionalArgs;
var args = $"{additionalArgs} {projectArgs}";
Copy link
Owner

Choose a reason for hiding this comment

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

The new change removes the "" wrapping the project path that is still needed.

@tareqimbasher
Copy link
Owner

tareqimbasher commented Jul 4, 2024

@Deliay I requested some changes before merging the PR.

In addition let's hold off on commit (Bump .NET to 8 and bump dependencies to latest version). The package upgrade has a little more to it, especially related to the swagger generated API client. For .NET 8 I want to run some tests on my end to make sure everything still works with that upgrade so I'll go ahead and update to .NET 8 in a later PR once I've validated it. Can you also revert the change to v8 in the README introduced in ac357ba.

Lastly, the change that you introduced in (Support lanuch OmniSharp server via 'dotnet exec OmniSharp.dll') did you test this still works when running the app without docker?

Really appreciate your contribution!

@Jogai
Copy link

Jogai commented Oct 4, 2024

@tareqimbasher would you be interested in another pr mainly for fixing the docker file? I have a a working dockerfile on my pc that uses a multistage build.

@tareqimbasher
Copy link
Owner

@Jogai yes I would be interested. Thanks for the contribution!

Copy link
Author

@Deliay Deliay left a comment

Choose a reason for hiding this comment

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

I haven't dealt with this pull request for a long time due to being busy with my daily life chores. There have been a lot of new changes over this long period of time, so I'll rebase entire branch to latest commit and fix issues in the review.

<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" Condition="'$(SKIP_SPA_BUILD)' != 'true' "/>
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" Condition=" '$(SKIP_SPA_BUILD)' != 'true' And '$(TARGET)' != 'web' " />
Copy link
Author

Choose a reason for hiding this comment

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

The frontend project has been built ahead in docker script, so we need to skip it when running the MSBuild target.

@Deliay Deliay changed the title Bump .NET versions and fix docker build script Fix docker build script Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants