在Gitlab CI / CD中在Linux上构建和部署Docker映像

时间:2020-06-25 00:47:33

标签: docker .net-core continuous-integration gitlab dockerfile

我有一个必须为.NET Core 3.1应用创建docker映像的要求。为此,我有这个docker文件。谁能帮助我创建用于创建docker映像的.gitlab-ci.yml文件并将其部署到Linux上的docker?

Docker文件

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1809 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
WORKDIR /src
COPY ./Service/ .
RUN dotnet restore "Service/Service.csproj"
COPY . .
WORKDIR "/src/Hervice"
RUN dotnet build "Service.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Service.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Service.dll"]

0 个答案:

没有答案