使用开发者主机环境加载docker时出现npm错误

时间:2018-10-04 18:06:21

标签: docker asp.net-core docker-compose

我曾经只使用dockerfile并运行docker build并运行命令来构建,但是效果很好。但是现在我制作了一个docker-compose文件和一个docker-compose.override文件,将环境设置为如下所示: 版本:“ 3.4”

services:
  app:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    ports:
      - "8080:80"

这是我的docker-compose.yml文件:

services:
  app:
    build: ./app

当我进行docker-compose时,出现npm错误,提示未安装。当我起飞ASPNETCORE_ENVIRONMENT = Development时,一切正常。

开发者主机为什么会出问题?

dockerfile:

FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app

RUN curl -sL https://deb.nodesource.com/setup_10.x |  bash -
RUN apt-get install -y nodejs

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/dotnet:aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "app.dll"]

0 个答案:

没有答案