Add basic Dockerfile to build image#58
Conversation
warriordog
left a comment
There was a problem hiding this comment.
@evolvingpixie thank you so much! I left a few questions / comments
| @@ -0,0 +1 @@ | |||
| **/appsettings.Development.json | |||
There was a problem hiding this comment.
does it also include the stuff in .gitignore?
There was a problem hiding this comment.
Don't think it does. Should copy the same things to this file.
There was a problem hiding this comment.
I don't think it needs the whole gitignore, but it should exclude appsettings.Local.json.
| key=$(echo "${item}" | cut -d "=" -f 1) | ||
| value=$(echo "${item}" | cut -d "=" -f 2-) | ||
| jq $key="\"$value\"" appsettings.json > $tmpfile && \ | ||
| mv $tmpfile appsettings.json |
There was a problem hiding this comment.
appsettings.json should not be modified, as it's meant to be a template of default values. Instead, user settings / overrides should go in appsettings.Production.json. The application will overlay the configurations, with Production getting priority.
| jq $key="\"$value\"" appsettings.json > $tmpfile && \ | ||
| mv $tmpfile appsettings.json | ||
| done | ||
| exec $@ |
There was a problem hiding this comment.
Make sure to set DOTNET_ENVIRONMENT=Production before running
|
|
||
| # Add modshark user and copy built modshark | ||
| RUN useradd -m -s /bin/bash modshark | ||
| COPY --from=builder --chown=modshark:modshark /ModShark/ModShark/bin/Release/net8.0/publish/ /ModShark |
There was a problem hiding this comment.
If it helps, there's now a /Resources/build-prod.ps1 script that runs a build and stages all the compiled output in a predictable /Publish directory. You can copy the whole thing as-is or just take parts.
There was a problem hiding this comment.
Awesome. Will try to take a look and possibly use that.
There was a problem hiding this comment.
ModShark requires database migrations upon installation and then with each update. They're meant to be run manually by a DBA / admin, but they could be bundled and run on startup.
Super basic and barely tested container build for ModShark. Can be used with a github action to build and publish.