site.css styles not being applied to Docker image with Visual Studio 2017 Docker build











up vote
0
down vote

favorite













  • I am using Windows to build a Linux container with Visual Studio 2017

  • I make a change to site.css in my ASP.Net Core web app, and a minor textual change to the home page to show the app current version.

  • I build and debug my docker image locally: SUCCESS (I see the changes)

  • I push my image to docker hub: SUCCESS!

  • I update my kubernetes deployment to pull the new image from docker hub: SUCCESS (I see the new image pulled, and I see the version change on the home page)

  • FAIL: I don't see the css changes!


If I open up the Chrome dev toolbar, it does not appear to be getting the right site.css - I can tell this by inspecting the elements - they have some other css being applied, not mine!
If I view source, it is referencing the minified version of the css file:



<link rel="stylesheet" href="/css/site.min.css?v=kHvJwvVAK1eJLN4w8xygUR3nbvlLmRwi5yr-OuAO90E" />


Here is the OOB Dockerfile from Visual Studio:



FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY SupportTicket.sln ./
COPY ST.Web/ST.Web.csproj ST.Web/
COPY ST.AppServicesLib/ST.AppServicesLib.csproj ST.AppServicesLib/
COPY ST.SharedInterfacesLib/ST.SharedInterfacesLib.csproj ST.SharedInterfacesLib/
COPY ST.SharedEntitiesLib/ST.SharedEntitiesLib.csproj ST.SharedEntitiesLib/
COPY ST.SQlServerRepoLib/ST.SQLServerRepoLib.csproj ST.SQlServerRepoLib/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/ST.Web
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ST.Web.dll"]


Question



If I can view the website correctly with a debug build, why is it not appearing correctly in the pushed image? (I expect the images to be identical)
How do I fix this?



Many Thanks!










share|improve this question




























    up vote
    0
    down vote

    favorite













    • I am using Windows to build a Linux container with Visual Studio 2017

    • I make a change to site.css in my ASP.Net Core web app, and a minor textual change to the home page to show the app current version.

    • I build and debug my docker image locally: SUCCESS (I see the changes)

    • I push my image to docker hub: SUCCESS!

    • I update my kubernetes deployment to pull the new image from docker hub: SUCCESS (I see the new image pulled, and I see the version change on the home page)

    • FAIL: I don't see the css changes!


    If I open up the Chrome dev toolbar, it does not appear to be getting the right site.css - I can tell this by inspecting the elements - they have some other css being applied, not mine!
    If I view source, it is referencing the minified version of the css file:



    <link rel="stylesheet" href="/css/site.min.css?v=kHvJwvVAK1eJLN4w8xygUR3nbvlLmRwi5yr-OuAO90E" />


    Here is the OOB Dockerfile from Visual Studio:



    FROM microsoft/aspnetcore:2.0 AS base
    WORKDIR /app
    EXPOSE 80

    FROM microsoft/aspnetcore-build:2.0 AS build
    WORKDIR /src
    COPY SupportTicket.sln ./
    COPY ST.Web/ST.Web.csproj ST.Web/
    COPY ST.AppServicesLib/ST.AppServicesLib.csproj ST.AppServicesLib/
    COPY ST.SharedInterfacesLib/ST.SharedInterfacesLib.csproj ST.SharedInterfacesLib/
    COPY ST.SharedEntitiesLib/ST.SharedEntitiesLib.csproj ST.SharedEntitiesLib/
    COPY ST.SQlServerRepoLib/ST.SQLServerRepoLib.csproj ST.SQlServerRepoLib/
    RUN dotnet restore -nowarn:msb3202,nu1503
    COPY . .
    WORKDIR /src/ST.Web
    RUN dotnet build -c Release -o /app

    FROM build AS publish
    RUN dotnet publish -c Release -o /app

    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app .
    ENTRYPOINT ["dotnet", "ST.Web.dll"]


    Question



    If I can view the website correctly with a debug build, why is it not appearing correctly in the pushed image? (I expect the images to be identical)
    How do I fix this?



    Many Thanks!










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite












      • I am using Windows to build a Linux container with Visual Studio 2017

      • I make a change to site.css in my ASP.Net Core web app, and a minor textual change to the home page to show the app current version.

      • I build and debug my docker image locally: SUCCESS (I see the changes)

      • I push my image to docker hub: SUCCESS!

      • I update my kubernetes deployment to pull the new image from docker hub: SUCCESS (I see the new image pulled, and I see the version change on the home page)

      • FAIL: I don't see the css changes!


      If I open up the Chrome dev toolbar, it does not appear to be getting the right site.css - I can tell this by inspecting the elements - they have some other css being applied, not mine!
      If I view source, it is referencing the minified version of the css file:



      <link rel="stylesheet" href="/css/site.min.css?v=kHvJwvVAK1eJLN4w8xygUR3nbvlLmRwi5yr-OuAO90E" />


      Here is the OOB Dockerfile from Visual Studio:



      FROM microsoft/aspnetcore:2.0 AS base
      WORKDIR /app
      EXPOSE 80

      FROM microsoft/aspnetcore-build:2.0 AS build
      WORKDIR /src
      COPY SupportTicket.sln ./
      COPY ST.Web/ST.Web.csproj ST.Web/
      COPY ST.AppServicesLib/ST.AppServicesLib.csproj ST.AppServicesLib/
      COPY ST.SharedInterfacesLib/ST.SharedInterfacesLib.csproj ST.SharedInterfacesLib/
      COPY ST.SharedEntitiesLib/ST.SharedEntitiesLib.csproj ST.SharedEntitiesLib/
      COPY ST.SQlServerRepoLib/ST.SQLServerRepoLib.csproj ST.SQlServerRepoLib/
      RUN dotnet restore -nowarn:msb3202,nu1503
      COPY . .
      WORKDIR /src/ST.Web
      RUN dotnet build -c Release -o /app

      FROM build AS publish
      RUN dotnet publish -c Release -o /app

      FROM base AS final
      WORKDIR /app
      COPY --from=publish /app .
      ENTRYPOINT ["dotnet", "ST.Web.dll"]


      Question



      If I can view the website correctly with a debug build, why is it not appearing correctly in the pushed image? (I expect the images to be identical)
      How do I fix this?



      Many Thanks!










      share|improve this question
















      • I am using Windows to build a Linux container with Visual Studio 2017

      • I make a change to site.css in my ASP.Net Core web app, and a minor textual change to the home page to show the app current version.

      • I build and debug my docker image locally: SUCCESS (I see the changes)

      • I push my image to docker hub: SUCCESS!

      • I update my kubernetes deployment to pull the new image from docker hub: SUCCESS (I see the new image pulled, and I see the version change on the home page)

      • FAIL: I don't see the css changes!


      If I open up the Chrome dev toolbar, it does not appear to be getting the right site.css - I can tell this by inspecting the elements - they have some other css being applied, not mine!
      If I view source, it is referencing the minified version of the css file:



      <link rel="stylesheet" href="/css/site.min.css?v=kHvJwvVAK1eJLN4w8xygUR3nbvlLmRwi5yr-OuAO90E" />


      Here is the OOB Dockerfile from Visual Studio:



      FROM microsoft/aspnetcore:2.0 AS base
      WORKDIR /app
      EXPOSE 80

      FROM microsoft/aspnetcore-build:2.0 AS build
      WORKDIR /src
      COPY SupportTicket.sln ./
      COPY ST.Web/ST.Web.csproj ST.Web/
      COPY ST.AppServicesLib/ST.AppServicesLib.csproj ST.AppServicesLib/
      COPY ST.SharedInterfacesLib/ST.SharedInterfacesLib.csproj ST.SharedInterfacesLib/
      COPY ST.SharedEntitiesLib/ST.SharedEntitiesLib.csproj ST.SharedEntitiesLib/
      COPY ST.SQlServerRepoLib/ST.SQLServerRepoLib.csproj ST.SQlServerRepoLib/
      RUN dotnet restore -nowarn:msb3202,nu1503
      COPY . .
      WORKDIR /src/ST.Web
      RUN dotnet build -c Release -o /app

      FROM build AS publish
      RUN dotnet publish -c Release -o /app

      FROM base AS final
      WORKDIR /app
      COPY --from=publish /app .
      ENTRYPOINT ["dotnet", "ST.Web.dll"]


      Question



      If I can view the website correctly with a debug build, why is it not appearing correctly in the pushed image? (I expect the images to be identical)
      How do I fix this?



      Many Thanks!







      visual-studio docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 at 17:43

























      asked Nov 14 at 17:14









      Banoona

      749




      749
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Preliminary answer (this is a workaround, and I would still like to get an answer on the central question as to why the debug website container != the deployed container):



          Comment out the minifier configuration in bundleconfig.json. This got it working for me. (But now I don't have any minification!):



          // Configure bundling and minification for the project.
          // More info at https://go.microsoft.com/fwlink/?LinkId=808241
          [
          //{
          // "outputFileName": "wwwroot/css/site.min.css",
          // // An array of relative input file paths. Globbing patterns supported
          // "inputFiles": [
          // "wwwroot/css/site.css"
          // ]
          //},
          {
          "outputFileName": "wwwroot/js/site.min.js",
          "inputFiles": [
          "wwwroot/js/site.js"
          ],
          // Optionally specify minification options
          "minify": {
          "enabled": true,
          "renameLocals": true
          },
          // Optionally generate .map file
          "sourceMap": false
          }
          ]


          Also, I commented out, and updated, the stylesheet reference in _layout.cshtml:



          <environment exclude="Development">
          <!-- etc -->
          @*<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />*@
          <link rel="stylesheet" href="~/css/site.css" />
          </environment>


          Any better answers, greatly appreciated.






          share|improve this answer























          • The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
            – Banoona
            Nov 14 at 18:18











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305523%2fsite-css-styles-not-being-applied-to-docker-image-with-visual-studio-2017-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Preliminary answer (this is a workaround, and I would still like to get an answer on the central question as to why the debug website container != the deployed container):



          Comment out the minifier configuration in bundleconfig.json. This got it working for me. (But now I don't have any minification!):



          // Configure bundling and minification for the project.
          // More info at https://go.microsoft.com/fwlink/?LinkId=808241
          [
          //{
          // "outputFileName": "wwwroot/css/site.min.css",
          // // An array of relative input file paths. Globbing patterns supported
          // "inputFiles": [
          // "wwwroot/css/site.css"
          // ]
          //},
          {
          "outputFileName": "wwwroot/js/site.min.js",
          "inputFiles": [
          "wwwroot/js/site.js"
          ],
          // Optionally specify minification options
          "minify": {
          "enabled": true,
          "renameLocals": true
          },
          // Optionally generate .map file
          "sourceMap": false
          }
          ]


          Also, I commented out, and updated, the stylesheet reference in _layout.cshtml:



          <environment exclude="Development">
          <!-- etc -->
          @*<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />*@
          <link rel="stylesheet" href="~/css/site.css" />
          </environment>


          Any better answers, greatly appreciated.






          share|improve this answer























          • The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
            – Banoona
            Nov 14 at 18:18















          up vote
          0
          down vote













          Preliminary answer (this is a workaround, and I would still like to get an answer on the central question as to why the debug website container != the deployed container):



          Comment out the minifier configuration in bundleconfig.json. This got it working for me. (But now I don't have any minification!):



          // Configure bundling and minification for the project.
          // More info at https://go.microsoft.com/fwlink/?LinkId=808241
          [
          //{
          // "outputFileName": "wwwroot/css/site.min.css",
          // // An array of relative input file paths. Globbing patterns supported
          // "inputFiles": [
          // "wwwroot/css/site.css"
          // ]
          //},
          {
          "outputFileName": "wwwroot/js/site.min.js",
          "inputFiles": [
          "wwwroot/js/site.js"
          ],
          // Optionally specify minification options
          "minify": {
          "enabled": true,
          "renameLocals": true
          },
          // Optionally generate .map file
          "sourceMap": false
          }
          ]


          Also, I commented out, and updated, the stylesheet reference in _layout.cshtml:



          <environment exclude="Development">
          <!-- etc -->
          @*<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />*@
          <link rel="stylesheet" href="~/css/site.css" />
          </environment>


          Any better answers, greatly appreciated.






          share|improve this answer























          • The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
            – Banoona
            Nov 14 at 18:18













          up vote
          0
          down vote










          up vote
          0
          down vote









          Preliminary answer (this is a workaround, and I would still like to get an answer on the central question as to why the debug website container != the deployed container):



          Comment out the minifier configuration in bundleconfig.json. This got it working for me. (But now I don't have any minification!):



          // Configure bundling and minification for the project.
          // More info at https://go.microsoft.com/fwlink/?LinkId=808241
          [
          //{
          // "outputFileName": "wwwroot/css/site.min.css",
          // // An array of relative input file paths. Globbing patterns supported
          // "inputFiles": [
          // "wwwroot/css/site.css"
          // ]
          //},
          {
          "outputFileName": "wwwroot/js/site.min.js",
          "inputFiles": [
          "wwwroot/js/site.js"
          ],
          // Optionally specify minification options
          "minify": {
          "enabled": true,
          "renameLocals": true
          },
          // Optionally generate .map file
          "sourceMap": false
          }
          ]


          Also, I commented out, and updated, the stylesheet reference in _layout.cshtml:



          <environment exclude="Development">
          <!-- etc -->
          @*<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />*@
          <link rel="stylesheet" href="~/css/site.css" />
          </environment>


          Any better answers, greatly appreciated.






          share|improve this answer














          Preliminary answer (this is a workaround, and I would still like to get an answer on the central question as to why the debug website container != the deployed container):



          Comment out the minifier configuration in bundleconfig.json. This got it working for me. (But now I don't have any minification!):



          // Configure bundling and minification for the project.
          // More info at https://go.microsoft.com/fwlink/?LinkId=808241
          [
          //{
          // "outputFileName": "wwwroot/css/site.min.css",
          // // An array of relative input file paths. Globbing patterns supported
          // "inputFiles": [
          // "wwwroot/css/site.css"
          // ]
          //},
          {
          "outputFileName": "wwwroot/js/site.min.js",
          "inputFiles": [
          "wwwroot/js/site.js"
          ],
          // Optionally specify minification options
          "minify": {
          "enabled": true,
          "renameLocals": true
          },
          // Optionally generate .map file
          "sourceMap": false
          }
          ]


          Also, I commented out, and updated, the stylesheet reference in _layout.cshtml:



          <environment exclude="Development">
          <!-- etc -->
          @*<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />*@
          <link rel="stylesheet" href="~/css/site.css" />
          </environment>


          Any better answers, greatly appreciated.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 at 18:20

























          answered Nov 14 at 18:14









          Banoona

          749




          749












          • The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
            – Banoona
            Nov 14 at 18:18


















          • The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
            – Banoona
            Nov 14 at 18:18
















          The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
          – Banoona
          Nov 14 at 18:18




          The following link was useful: github.com/madskristensen/BundlerMinifier/issues/217
          – Banoona
          Nov 14 at 18:18


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305523%2fsite-css-styles-not-being-applied-to-docker-image-with-visual-studio-2017-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?