I'm fresher for docker. I had a bad network. Every time building the asp.net core project,it always stuck at dotnet restore step.
Because the project reference abp myget nightly. The error information:
Step 8/9 : RUN dotnet restore "IC.AuthServer.csproj" ---> Running in 4232f5677921 Failed to download package 'Volo.Abp.Core.0.19.0-preview20190724' from 'https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/volo.abp.core/0.19.0-preview20190724/volo.abp.core.0.19.0-preview20190724.nupkg'. The SSL connection could not be established, see inner exception. Unable to read data from the transport connection: Connection reset by peer. Connection reset by peer Failed to download package 'Volo.Abp.IdentityServer.Domain.Shared.0.19.0-preview20190724' from 'https://www.myget.org/F/abp-nightly/api/v3/flatcontainer/volo.abp.identityserver.domain.shared/0.19.0-preview20190724/volo.abp.identityserver.domain.shared.0.19.0-preview20190724.nupkg'. The SSL connection could not be established, see inner exception. Unable to read data from the transport connection: Connection reset by peer.
I had get abp packages at ~/.nuget/. I attempt copy this to docker. but copy not support absolute path. Through I can copy it to current context directory. but it's so ugly .
Is there any way to mount host directory when building image?
Thanks in advance.
Here is Docker-compose.yml:
version: "3"
services:
db-mysql:
image: mysql
ports:
- "3308:3306"
volumes:
- mysql_data:/var/lib/mysql
- mysql_init_files:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: "Coriander_Account"
MYSQL_ROOT_PASSWORD: "123456"
auth-server:
build:
context: ./
dockerfile: Applications/IC.AuthServer.Host/Dockerfile
depends_on:
- db-mysql
ports:
- "6001:80"
volumes:
mysql_data:
dbdata:
mysql_init_files:
Here is Dockerfile:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY . .
WORKDIR "/src/Applications/IC.AuthServer.Host/"
// * I want to let docker mounting host directory at here. *
RUN dotnet restore "IC.AuthServer.csproj"
RUN dotnet build "IC.AuthServer.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "IC.AuthServer.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "IC.AuthServer.dll"]