Skip to content

Conversation

evolvingpixie
Copy link

Super basic and barely tested container build for ModShark. Can be used with a github action to build and publish.

Copy link
Owner

@warriordog warriordog left a comment

Choose a reason for hiding this comment

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

@evolvingpixie thank you so much! I left a few questions / comments

@@ -0,0 +1 @@
**/appsettings.Development.json
Copy link
Owner

Choose a reason for hiding this comment

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

does it also include the stuff in .gitignore?

Copy link
Author

Choose a reason for hiding this comment

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

Don't think it does. Should copy the same things to this file.

Copy link
Owner

Choose a reason for hiding this comment

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

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
Copy link
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Author

Choose a reason for hiding this comment

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

Noted. WIll fix.

jq $key="\"$value\"" appsettings.json > $tmpfile && \
mv $tmpfile appsettings.json
done
exec $@
Copy link
Owner

Choose a reason for hiding this comment

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

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
Copy link
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Author

Choose a reason for hiding this comment

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

Awesome. Will try to take a look and possibly use that.

Copy link
Owner

Choose a reason for hiding this comment

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

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.

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.

2 participants