question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker + Alpine Linux - AspNetCore.SassCompiler.targets(11,5): error : Error running sass compiler:

See original GitHub issue

I have edited this issue now that I have done some more research and have create a bare repository to help demo the issue:

The issue seems to be when building with an Alpine Linux Docker image with AspNetCore.SassCompiler.

If you inherit from the usual FROM mcr.microsoft.com/dotnet/sdk:6.0 Ubuntu image then all builds and works as normal however if you inherit from the Alpine version FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine then you get build errors such as:

#14 0.508 Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
#14 0.508 Copyright (C) Microsoft Corporation. All rights reserved.
#14 0.508
#14 2.574 /root/.nuget/packages/aspnetcore.sasscompiler/1.52.3/build/AspNetCore.SassCompiler.targets(11,5): error : Error running sass compiler:  [/source/aspnetcore-alpine-sass.csproj]
#14 2.574 /root/.nuget/packages/aspnetcore.sasscompiler/1.52.3/build/AspNetCore.SassCompiler.targets(11,5): error : . [/source/aspnetcore-alpine-sass.csproj]
#14 5.668   aspnetcore-alpine-sass -> /source/bin/release/net6.0/linux-musl-x64/aspnetcore-alpine-sass.dll
#14 5.732   aspnetcore-alpine-sass -> /app/
------
executor failed running [/bin/sh -c dotnet publish -c release -o /app -r linux-musl-x64 --no-self-contained --no-restore]: exit code: 1

I think it may have something to do with dart sass itself.

I have created a repo to demonstrate the bug and have a little more info in the readme.md over there.

https://github.com/solrevdev/aspnetcore-alpine-sass

Desktop (please complete the following information):

 OS: 64bit Mac OS X 10.15.7 19H1922
 Kernel: x86_64 Darwin 19.6.0
 Uptime: 2h 43m
 Packages: 547
 Shell: zsh 5.9
 Resolution: 1920x1080
 DE: Aqua
 WM: Quartz Compositor
 WM Theme: Blue
 Disk: 11G / 480G (5%)
 CPU: Intel Core i7-3615QM @ 2.30GHz
 GPU: Intel HD Graphics 4000
 RAM: 8217MiB / 16384MiB
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.300
 Commit:    8473146e7d

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.300/

Host (useful for support):
  Version: 6.0.5
  Commit:  70ae3df4a6

.NET SDKs installed:
  3.1.419 [/usr/local/share/dotnet/sdk]
  6.0.300 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.25 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.25 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
solrevdevcommented, Jun 13, 2022

Thanks @a-van-rooyen for your glibc-2.34-r0.apk fix.

Very interesting! Happy to see that it compiles successfully now 😄

Damn version compatibility 😂

1reaction
solrevdevcommented, Jun 13, 2022

Very interesting!

So that didn’t work for me yet your 3 lines compiled. Yours uses glibc-2.34-r0.apk whereas I grabbed from the source site glibc-2.35-r0.apk

https://github.com/CargoSense/dart_sass#compatibility-with-alpine-linux-mix-sass-default-exited-with-2 verses https://github.com/sgerrand/alpine-pkg-glibc#installing

See my comments

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
WORKDIR /source

RUN apk update
- #RUN apk add gcompat

+ # THIS FROM YOURS COMPILES! https://github.com/CargoSense/dart_sass#compatibility-with-alpine-linux-mix-sass-default-exited-with-2
+ #RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
+ #RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
+ #RUN apk add glibc-2.34-r0.apk
+ 
+ # THIS FROM SOURCE SITE DOES NOT https://github.com/sgerrand/alpine-pkg-glibc#installing
+ RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
+ RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk
+ RUN apk add glibc-2.35-r0.apk

COPY ./ ./
RUN dotnet restore -r linux-musl-x64
RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-self-contained --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine-amd64
WORKDIR /app
COPY --from=build /app ./

EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "aspnetcore-alpine-sass.dll"]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Alpine linux support still not fully working #1868
I upgraded to the latest version as introduced Alpine linux support in #1589. Building Alpine linux docker container and running yarn install ...
Read more >
Issue to node-sass and Docker
I have a similar error, only when I run the docker container on a Linux machine, in MAC is working perfect!! I think...
Read more >
AspNetCore.SassCompiler 1.49.4
Sass Compiler Library for .NET Core 3.1/5.x/6.x. without node, using dart-sass as a compiler.
Read more >
Running ASP.NET Core in an Alpine Linux Docker Container
The error here is that the debian docker image we are using doesn't have the nightly version of the 2.1 runtime installed and...
Read more >
Sass building for prod in container - Elixir Forum
It works on my machine. I added DartSass to my project. However when attempting to build it in a Docker container for release,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found