dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.53k stars 10.35k forks source link

build fails with error sha256sum.exe not found #630

Closed vramanx closed 6 years ago

vramanx commented 6 years ago

command: docker-compose -f docker-compose-windows.yml build error: 'sha256sum' is not recognized as an internal or external command, operable program or batch file.

i downloaded the tool from http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe&quot

and added it to path. it still fails.

mvelosop commented 6 years ago

Hi @vramanx,

When using Docker multi-stage build (which we are using since Dec'17) it really doesn't matter what you have installed on your computer, but what's available in the base image you are using.

It looks like you are tying to run the app using Windows Containers, is that what you intend to do?

I suggest you start by reading the development environment setup instructions in the wiki, these have mostly worked when followed in detail.

Pay special attention to the Docker configuration section.

CESARDELATORRE commented 6 years ago

@mvelosop - However, he’s trying to deploy on Windows Containers. I think we haven’t tested the latest version on Windows Containers the same way we usually work on Linux Containers. Can you check that out by using the Docker-compose-Windows.yml file? There’s a possibility that something related to Windows Containers could be outdated in our code.

mvelosop commented 6 years ago

Thanks @CESARDELATORRE, I already tested in Windows Containers and it fails building identity.api, but it's a completely different error. I'll discuss this with @eiximenis.

Just wanted to be sure about what @vramanx was actually trying to achieve, because everything works ok with Linux Containers.

vramanx commented 6 years ago

Thanks for the response Miguel.

I followed instructions from https://github.com/dotnet-architecture/eShopOnContainers/wiki/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers

Yes i am trying to use windows containers.

I am new to containers. Please bear with me if the questions are elementary.

I see below from the console log

Building identity.api Step 1/22 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base

Does this mean the image being used is microsoft/dotnet:2.1-aspnetcore-runtime?

How do i check if this image has sh256sum.exe?

jstallm commented 6 years ago

@CESARDELATORRE Docker-compose is failing for me as well on Windows Containers due to the below code. It looks like there needs to be an alternative RUN command/step for those running this solution under windows containers to ensure that node is installed some substitute for this code lines here RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \ && echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \ && tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \ && rm nodejs.tar.gz \ && ln -s /usr/local/bin/node /usr/local/bin/nodejs diff of issue shown below image

The issue with Identity is the same problem, since these three projects have that code in their dockerfile. The only reason why you are not getting to WebMVC and WebSPA is because identity is a dependency. If you were to ignore the identity in the docker-compose, youll see the issue repeat at WebMVC and WebSPA There needs to be a pull request for three files Identity.API dockerfile WebMVC dockerfile WebSPA dockerfile at least

@mvelosop , the instructions no longer work, because the code above is still run for windows containers when using those steps

@vramanx , you can try switching to linux containers on your local machine to see if you can build that way. The lesson here is that it appears pull requests are not tested against windows containers before they are merged...:/ which leads to the question: If PR are not tested against windows containers, whats the use of having the windows container code at all? For instance, all the overrides and file renaming instructions, creates noise. ANd if its not reliable, its not as useful, right? So building is broken since the last PR was made into dev branch

mvelosop commented 6 years ago

@eiximenis, @CESARDELATORRE, from what @jstallm found and what I understand, I see two issues here:

  1. For the microsoft/dotnet:2.1-aspnetcore-runtime
    the Linux Dockerfile installs curl but
    the Windows-1709 Dockerfile doesn't and that should be fixed there right?

  2. I guess (building on @jstallm comment) that there should be a different Dockerfile for Windows, as even after you have curl installed, you won't download the nodejs.tar.gz file on Windows right?

eiximenis commented 6 years ago

Hi!!! That was my fault :(

NetCore 2.1 RTM images are based on microsoft/dotnet-sdk instead of previous microsoft/aspnetcore-build which is deprecated (RC1 images are still based on microsoft-aspnetcore-build). Unfortunately the new microsoft/dotnet-sdk do not include nodejs** which is needed for mvc, spa, identity and webapi. I've tested everyhting when RC1 (using microsoft-aspnetcore-build) and it worked well, but when updating to 2.1 RTM and changed the Dockerfile to include nodejs I forgot about windows containers :(

As @mvelosop said to fix this we would need a specific Dockerfile for windows which is unfortunate...

This is high prioriry bug that I will face ASAP.

Thanks!

jstallm commented 6 years ago

@eiximenis, how would we go about making sure that all PR approved for merge are tested against windows containers everytime so that we dont get unexpected instances of PR breaking since the pull request was somewhat container specific (linux/windows), and not specified in the PR itself. Just wondering if there is a way to check the status of a particular PR ( ensure it has been tested for what it is I want to do).

mvelosop commented 6 years ago

@eiximenis perhaps we could devise a script or something (python?) than handles the details of installing the appropriate node for the environment, so we can keep the same Dockerfile!

eiximenis commented 6 years ago

Hi everybody. I pushed a new set of Dockerfiles in dev branch to solve this issue. Feel free to check the commit (fcff8e45aa077f046c4318496e84df1617ea6d1d) for viewing the changes.

Also updated https://github.com/dotnet-architecture/eShopOnContainers/wiki/08.-Setting-up-and-Deploying-eShopOnContainers-to-Windows-Containers with the new information.

Now for building windows containers should use:

docker-compose -f docker-compose.yml -f docker-compose.windows.yml build

And for running them:

set ESHOP_OCELOT_VOLUME_SPEC=C:\app\configuration
docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml -f docker-compose.windows.yml -f docker-compose.override.windows.yml up

Just let me know if this is OK, and reopen issue if any problems!

/cc @CESARDELATORRE @mvelosop