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.

Error building cartservice

See original GitHub issue

Hello 😃

I cloned the code and I am trying to build the cartservice docker image on my ubuntu VM but I have the following error :

$ docker build -t cartservice .
Sending build context to Docker daemon  427.5kB
Step 1/10 : FROM mcr.microsoft.com/dotnet/sdk:5.0 as builder
 ---> 933354c487f6
Step 2/10 : WORKDIR /app
 ---> Using cache
 ---> 84bb85aa284d
Step 3/10 : COPY . .
 ---> Using cache
 ---> 73dcdd68b1c3
Step 4/10 : RUN dotnet publish -r linux-musl-x64 --self-contained true -c release -o /cartservice
 ---> Running in d2a103e15c70
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /app/cartservice.csproj (in 1.22 min).
/app/tests/CartServiceTests.cs(19,7): error CS0246: The type or namespace name 'Xunit' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(29,10): error CS0246: The type or namespace name 'FactAttribute' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(29,10): error CS0246: The type or namespace name 'Fact' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(54,10): error CS0246: The type or namespace name 'FactAttribute' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(54,10): error CS0246: The type or namespace name 'Fact' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(96,10): error CS0246: The type or namespace name 'FactAttribute' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
/app/tests/CartServiceTests.cs(96,10): error CS0246: The type or namespace name 'Fact' could not be found (are you missing a using directive or an assembly reference?) [/app/cartservice.csproj]
The command '/bin/sh -c dotnet publish -r linux-musl-x64 --self-contained true -c release -o /cartservice' returned a non-zero code: 1

Anything I missed please ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mathieu-benoitcommented, Dec 9, 2020

Great to hear it works as expected, thanks for following up.

For your bonus question, there is an open issue https://github.com/GoogleCloudPlatform/microservices-demo/issues/428 to re-enable these .NET unit tests, looks like there is some work to do to have them running properly.

Closing this current issue for now.

1reaction
yogeekcommented, Dec 9, 2020

Hello @mathieu-benoit and thank you for your help !

Indeed, your commands are working well. I investigated a little bit and it appears that I copied the src/cartservice in a separate folder with cp -r src/cartservice/* before building the image : and so, the little hidden .dockerignore file was not part of my directory, and I guess this caused the error because of this line : once I retrieved the .dockerignore file, my build was ok !

Bonus question : I saw that these were commented here : is this because of the time it takes ?

Thanks !

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes the cart service failure in this Angular 13 app?
One trick with error messages is to sometimes use a different browser. With firefox I have error this.cartService is undefined .
Read more >
Set up Errors Inbox - New Relic Developers
Under Select entities, click Add for each of the following services to include it in the workload: geek-shop-cart-service; geek-shop-catalogue-service; geek- ...
Read more >
Building a Laravel App with TDD - Honeybadger Developer Blog
In this tutorial, learn how to build a Laravel app using TDD. ... Honeybadger includes error tracking with a whole suite of amazing ......
Read more >
How To Build An E-Commerce Site With Angular 11 ...
Cart Service #. The cart is responsible for maintaining the quantity of items added and the order Id. Making API calls to get...
Read more >
express-http-error - npm
WIP: Express HTTP Error. Build Status · Code Climate · Test Coverage. An opinionated RESTful HTTP error handler intended for use in Express....
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