vue.js - .NET Core 3 Web API + SPA 应用程序 (vue) 的 Dockerfile
问题描述
由于 .NET Core 3 Web API 可以通过 NuGet 包 VueCliMiddleware 与 Vue 很好地配合使用。如何编写一个有效的简单 Dockerfile?
解决方案
嗯,首先我不推荐这个,因为构建时间很慢。您在下面看到的这个 dockerfile 是实验性的,所以请确保您进行必要的修改以使其准备好投入生产!
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY . .
RUN dotnet restore Nozomi.Web2/Nozomi.Web2.csproj
# Required libraries in Unix
RUN apt-get update -q && apt-get install -q -y \
curl apt-transport-https apt-utils dialog \
make g++ build-essential
# Node Bash Script for Debian
# https://github.com/nodesource/distributions#deb
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
# Propagate Node for Docker
RUN apt-get update \
&& apt-get install -y nodejs
# Copy everything else and build
RUN dotnet publish Nozomi.Web2/Nozomi.Web2.csproj -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Nozomi.Web2.dll"]
推荐阅读
- python-3.x - 将 UTC 格式的 Python 日期时间对象转换为本地时间
- sharepoint - 在 QnA Maker 知识库中导入 Sharepoint 页面不起作用
- spring-integration - Spring 集成 - 无法在 BeanFactory 中查找名称为“55774d05-e054-4b71-bc7e-ecc53d029e75:20”的 MessageChannel
- python - Python 代码作为脚本在 ipython 中运行,但在 jupyter-notebook 中抛出错误
- angular - 获取动态构建的反应形式的第一个值
- here-api - HERE 地图 - 卡车限制
- r - 如何在 R 中更广泛地旋转 NoSQL 数据
- python - 如何在客户端机器上执行 python 脚本?
- flutter - 如何在 Visual Studio 代码中从颤振项目创建自己的 sdk
- cytoscape.js - 在 Cytoscape 中的节点内键入文本