build: update linux.docker file

This commit is contained in:
Argo Zhang 2019-09-04 23:45:50 +08:00
parent fe542d8131
commit 65926abb0b
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
4 changed files with 18 additions and 20 deletions

View File

@ -1,6 +1,9 @@
name: Docker Image CI
on: [push]
on:
push:
branches:
- master
jobs:
@ -11,4 +14,4 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file src/admin/Linux.Dockerfile --tag BA:$(date +%s)
run: docker build . --file src/admin/Bootstrap.Admin/Linux.Dockerfile --tag ba:$(date +%s)

View File

@ -7,19 +7,15 @@ EXPOSE 80
FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build
WORKDIR /src
COPY ["Bootstrap.Admin/Bootstrap.Admin.csproj", "Bootstrap.Admin/"]
COPY ["Bootstrap.DataAccess/Bootstrap.DataAccess.csproj", "Bootstrap.DataAccess/"]
RUN dotnet restore "Bootstrap.Admin/Bootstrap.Admin.csproj"
COPY . .
WORKDIR "/src/Bootstrap.Admin"
RUN dotnet build "Bootstrap.Admin.csproj" -c Release -o /app
COPY src/admin .
WORKDIR "/src/Bootstrap.Admin"
FROM build AS publish
RUN dotnet publish "Bootstrap.Admin.csproj" -c Release -o /app
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
COPY --from=build ["/src/Bootstrap.Admin/BootstrapAdmin.db", "./BootstrapAdmin.db"]
COPY --from=build ["/src/Scripts/Longbow.lic", "./Longbow.lic"]
COPY --from=publish ["/src/Bootstrap.Admin/BootstrapAdmin.db", "./BootstrapAdmin.db"]
COPY --from=publish ["/src/Longbow.lic", "./Longbow.lic"]
ENTRYPOINT ["dotnet", "Bootstrap.Admin.dll"]

View File

@ -1,22 +1,21 @@
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["Bootstrap.Admin/Bootstrap.Admin.csproj", "Bootstrap.Admin/"]
COPY ["Bootstrap.DataAccess/Bootstrap.DataAccess.csproj", "Bootstrap.DataAccess/"]
RUN dotnet restore "Bootstrap.Admin/Bootstrap.Admin.csproj"
COPY . .
WORKDIR "/src/Bootstrap.Admin"
RUN dotnet build "Bootstrap.Admin.csproj" -c Release -o /app
COPY src/admin .
WORKDIR "/src/Bootstrap.Admin"
FROM build AS publish
RUN dotnet publish "Bootstrap.Admin.csproj" -c Release -o /app
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
COPY --from=publish ["/src/Bootstrap.Admin/BootstrapAdmin.db", "./BootstrapAdmin.db"]
COPY --from=publish ["/src/Scripts/Longbow.lic", "./Longbow.lic"]
COPY --from=publish ["/src/Longbow.lic", "./Longbow.lic"]
ENTRYPOINT ["dotnet", "Bootstrap.Admin.dll"]