SemenMartynov / Software-Engineering-2022

Peter the Great St. Petersburg Polytechnic University: Software Engineering course 2022
MIT License
4 stars 1 forks source link

Light blockchain #284

Closed theburyat closed 1 year ago

theburyat commented 1 year ago

Student, group: Buryanov Dmitry, 3530901/90202 URL: https://github.com/theburyat/BlockchainLight Any comments: C#, websockets, git-flow

SemenMartynov commented 1 year ago

Где-то ошибка в путях. Ну и обычно Dockerfile и docker-compose принято в корень проекта выкладывать.

smart@thinkpad$ docker build -t theburyat/blockchain .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  45.57kB
Step 1/15 : FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
6.0: Pulling from dotnet/runtime
26c5c85e47da: Already exists 
6df469f23ae1: Already exists 
7e979fe76393: Already exists 
6c9b5f8b63cb: Already exists 
Digest: sha256:3b77b184e337211aeb354a5e5a64fcbc4c1b51c9912e0039036bafda65465391
Status: Downloaded newer image for mcr.microsoft.com/dotnet/runtime:6.0
 ---> 2ca6c392302a
Step 2/15 : WORKDIR /app
 ---> Running in 7bd86e98dc9a
Removing intermediate container 7bd86e98dc9a
 ---> 41d6b58baaf2
Step 3/15 : FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
6.0: Pulling from dotnet/sdk
26c5c85e47da: Already exists 
6df469f23ae1: Already exists 
7e979fe76393: Already exists 
6c9b5f8b63cb: Already exists 
74ba3f43cec3: Already exists 
0e5a2f74bd05: Already exists 
e1951c9f38be: Already exists 
7d08a5a0ba03: Already exists 
Digest: sha256:d5f9090e564d391c0f00005bc06c74d1f97ccc59d561d3e161d7d3e3acdcd0ca
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:6.0
 ---> 9436a9652a1f
Step 4/15 : WORKDIR /src
 ---> Running in 4a26c8116013
Removing intermediate container 4a26c8116013
 ---> 3cea7e260adc
Step 5/15 : COPY ["BlockchainLight/BlockchainLight.csproj", "BlockchainLight/"]
COPY failed: file not found in build context or excluded by .dockerignore: stat BlockchainLight/BlockchainLight.csproj: file does not exist
theburyat commented 1 year ago

@SemenMartynov fixed

SemenMartynov commented 1 year ago

Я не очень понимаю что означает эта ошибка... Не получается что-то выкачать из репозитория пакетов?

smart@thinkpad$ docker build -t theburyat/blockchain .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  1.282MB
Step 1/15 : FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
 ---> 2ca6c392302a
Step 2/15 : WORKDIR /app
 ---> Using cache
 ---> 792318217cda
Step 3/15 : FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
 ---> 9436a9652a1f
Step 4/15 : WORKDIR /src
 ---> Using cache
 ---> c7a4a0281755
Step 5/15 : COPY ["BlockchainLight/BlockchainLight.csproj", "BlockchainLight/"]
 ---> Using cache
 ---> 3fd12d57d299
Step 6/15 : RUN dotnet restore "BlockchainLight/BlockchainLight.csproj"
 ---> Running in ee2a6e788c2d
  Determining projects to restore...
/src/BlockchainLight/BlockchainLight.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json.
theburyat commented 1 year ago

да, на вашей машине нет доступа к nuget репозиторию, попробуйте в ~/.nuget/NuGet/NuGet.config создать файл с подобным содержимым:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>
SemenMartynov commented 1 year ago

Закинь этот файл в docker, плиз.

theburyat commented 1 year ago

@SemenMartynov добавил конфигу в репу, теперь зависимости должны резолвиться корректно

SemenMartynov commented 1 year ago

Та же проблема

Step 7/16 : RUN dotnet restore "BlockchainLight/BlockchainLight.csproj"
 ---> Running in d2cf63f857ae
  Determining projects to restore...
/src/BlockchainLight/BlockchainLight.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json.

Я смотрю на

WORKDIR /src
COPY ["nuget.config", ""]

И не уверен, что файл оказывается по тому пути, который ему нужен...

SemenMartynov commented 1 year ago

Как вариант... Если на твоей стороне образ билдится, может его на докер-хаб залить?

theburyat commented 1 year ago

@SemenMartynov

И не уверен, что файл оказывается по тому пути, который ему нужен...

Если файл лежит хоть где-то, не важно где в репозитории, он будет использоваться при резолве зависимостей, насколько я знаю.

Залил образ на докер-хаб: https://hub.docker.com/repository/docker/theburyat/blockchain Поправил docker compose на использование конкретного имаджа

SemenMartynov commented 1 year ago

Окей, с хаба образ получить удалось. А локально собрать -- нет...