Plugins not building with Docker

1 年 前
Has anyone been able to get the plugins to compile and install along with the app when using the docker containers?
Following the instructions here We are able to successfully build and launch the app but none of our plugins are available. When we try to manually install a plugin the container immediately crashes.

here is our Dockerfile

# create the build instance
FROM microsoft/dotnet:2.2-sdk AS build

WORKDIR /src
COPY ./src ./

# restore solution
RUN dotnet restore NopCommerce.sln

WORKDIR /src/Presentation/Nop.Web

# build and publish project
RUN dotnet build Nop.Web.csproj -c Release -o /app
RUN dotnet publish Nop.Web.csproj -c Release -o /app/published

# create the runtime instance
FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS runtime

# add globalization support
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

WORKDIR /app
RUN mkdir bin
RUN mkdir logs

COPY --from=build /app/published .

ENTRYPOINT ["dotnet", "Nop.Web.dll"]

COPY /buildFiles/dataSettings.json /app/App_Data/dataSettings.json
1 年 前
I found the answer.

They have updated their docker file to include the lines for building plugins

https://github.com/nopSolutions/nopCommerce/blob/develop/Dockerfile


now my Dockerfile looks like  this

# create the build instance
FROM microsoft/dotnet:2.2-sdk AS build

WORKDIR /src
COPY ./src ./

# restore solution
RUN dotnet restore NopCommerce.sln

WORKDIR /src/Presentation/Nop.Web

# build and publish project
RUN dotnet build Nop.Web.csproj -c Release -o /app

# build plugins
WORKDIR /src/Plugins/Nop.Plugin.DiscountRules.CustomerRoles
RUN dotnet build Nop.Plugin.DiscountRules.CustomerRoles.csproj
WORKDIR /src/Plugins/Nop.Plugin.ExchangeRate.EcbExchange
RUN dotnet build Nop.Plugin.ExchangeRate.EcbExchange.csproj
WORKDIR /src/Plugins/Nop.Plugin.ExternalAuth.Facebook
RUN dotnet build Nop.Plugin.ExternalAuth.Facebook.csproj
WORKDIR /src/Plugins/Nop.Plugin.Misc.SendinBlue
RUN dotnet build Nop.Plugin.Misc.SendinBlue.csproj
WORKDIR /src/Plugins/Nop.Plugin.Payments.CheckMoneyOrder
RUN dotnet build Nop.Plugin.Payments.CheckMoneyOrder.csproj
WORKDIR /src/Plugins/Nop.Plugin.Payments.Manual
RUN dotnet build Nop.Plugin.Payments.Manual.csproj
WORKDIR /src/Plugins/Nop.Plugin.Payments.PayPalStandard
RUN dotnet build Nop.Plugin.Payments.PayPalStandard.csproj
WORKDIR /src/Plugins/Nop.Plugin.Payments.Qualpay
RUN dotnet build Nop.Plugin.Payments.Qualpay.csproj
WORKDIR /src/Plugins/Nop.Plugin.Payments.Square
RUN dotnet build Nop.Plugin.Payments.Square.csproj
WORKDIR /src/Plugins/Nop.Plugin.Pickup.PickupInStore
RUN dotnet build Nop.Plugin.Pickup.PickupInStore.csproj
WORKDIR /src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal
RUN dotnet build Nop.Plugin.Shipping.FixedByWeightByTotal.csproj
WORKDIR /src/Plugins/Nop.Plugin.Shipping.UPS
RUN dotnet build Nop.Plugin.Shipping.UPS.csproj
WORKDIR /src/Plugins/Nop.Plugin.Tax.Avalara
RUN dotnet build Nop.Plugin.Tax.Avalara.csproj
WORKDIR /src/Plugins/Nop.Plugin.Tax.FixedOrByCountryStateZip
RUN dotnet build Nop.Plugin.Tax.FixedOrByCountryStateZip.csproj
WORKDIR /src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics
RUN dotnet build Nop.Plugin.Widgets.GoogleAnalytics.csproj
WORKDIR /src/Plugins/Nop.Plugin.Widgets.NivoSlider
RUN dotnet build Nop.Plugin.Widgets.NivoSlider.csproj

# publish project
WORKDIR /src/Presentation/Nop.Web
RUN dotnet publish Nop.Web.csproj -c Release -o /app/published


# create the runtime instance
FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS runtime

# add globalization support
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

WORKDIR /app
RUN mkdir bin
RUN mkdir logs

COPY --from=build /app/published .

ENTRYPOINT ["dotnet", "Nop.Web.dll"]

COPY /buildFiles/dataSettings.json /app/App_Data/dataSettings.json
1 年 前
Is it necessary to build a plugin in the Linux environment ("RUN dotnet build Nop.Plugin. ...") to get it to work there?  I.e. If I compile my plugin in Windows environment, can it run as-is in the Linux environment?

Does it install the same way (put pre-built plugin folder in \Plugins folder, and restart the site, and it will show on the plugins install page)?
11 个月 前
Hi, thanks a lot for your post.

I have exactly the problem you described. It wasn't difficult to make the project compile and run in docker on Linux but each time I tried to add a plugin, the container crashed. I've spent so much time trying to resolve the issue. I don't think it is possible to add plugins or themes compiled in Windows (which is weird - the netcore runtime environment shouldn't care at all). Unfortunately the recommended way of installing plugins (either using 'upload plugin' button or unzipping into the 'Plugins' folder doesn't work). I will follow your advice and change the Dockerfile to compile plugins in place. Just curious if you have found any other solution to the problem.
11 个月 前
Building plugins from docker build is the best way. We also noticed several issues with plugin uploading. Moreover, when you build it using Dockerfile, it make sure that your app image is most up to date and easily portable as what docker offers.
2 个月 前
I was able to build the plugin template (it did contain a couple errors initially but was able to fix) from the docker build, the folder does show up in the Plugins folder inside the volume, but not in the bin subfolder inside, it's also not showing inside the administration section of the application.

if i manually place the dll in the bin subfolder, the application deletes it.

Any hints on this?
2 个月 前
oh i have a warning on it...

plugin is not compatible or cannot be loaded.

I'll compare with other plugins to see if i missed something... still though, is the template outdated or something?

Thanks!
2 个月 前
ok rewriting from scratch worked, i guess the template plugin is incomplete in some regards, didnt go through the differences but a blank plugin with just install and uninstall overrides worked.