From fe542d81318fcc0377787d049b9a9679ac6fa8cc Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 3 Sep 2019 23:05:13 +0800 Subject: [PATCH 1/5] build: Add docker action --- .github/workflows/dockerimage.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/dockerimage.yml diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml new file mode 100644 index 00000000..52ddc807 --- /dev/null +++ b/.github/workflows/dockerimage.yml @@ -0,0 +1,14 @@ +name: Docker Image CI + +on: [push] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build the Docker image + run: docker build . --file src/admin/Linux.Dockerfile --tag BA:$(date +%s) From 65926abb0bde86682c12fdacd83838945d25f291 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 4 Sep 2019 23:45:50 +0800 Subject: [PATCH 2/5] build: update linux.docker file --- .../workflows/{dockerimage.yml => docker.yml} | 7 +++++-- src/admin/Bootstrap.Admin/Dockerfile | 14 +++++--------- src/admin/Bootstrap.Admin/Linux.Dockerfile | 17 ++++++++--------- {scripts => src/admin}/Longbow.lic | 0 4 files changed, 18 insertions(+), 20 deletions(-) rename .github/workflows/{dockerimage.yml => docker.yml} (51%) rename {scripts => src/admin}/Longbow.lic (100%) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/docker.yml similarity index 51% rename from .github/workflows/dockerimage.yml rename to .github/workflows/docker.yml index 52ddc807..dd3f45e2 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/docker.yml @@ -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) diff --git a/src/admin/Bootstrap.Admin/Dockerfile b/src/admin/Bootstrap.Admin/Dockerfile index 04979df9..ee7219dc 100644 --- a/src/admin/Bootstrap.Admin/Dockerfile +++ b/src/admin/Bootstrap.Admin/Dockerfile @@ -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"] \ No newline at end of file diff --git a/src/admin/Bootstrap.Admin/Linux.Dockerfile b/src/admin/Bootstrap.Admin/Linux.Dockerfile index 3df692f5..59a4c78a 100644 --- a/src/admin/Bootstrap.Admin/Linux.Dockerfile +++ b/src/admin/Bootstrap.Admin/Linux.Dockerfile @@ -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"] \ No newline at end of file diff --git a/scripts/Longbow.lic b/src/admin/Longbow.lic similarity index 100% rename from scripts/Longbow.lic rename to src/admin/Longbow.lic From 06c2b29ca15cda384b4e725a6139a6291be949ba Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 5 Sep 2019 01:17:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?build:=20=E5=A2=9E=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=BC=96=E8=AF=91=20actions=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ca93100e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Auto Build CI + +on: + push: + branches: + - master + - dev-Actions + + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.2.108 + - name: Build with dotnet + run: dotnet build src/admin/Bootstrap.Admin/ --configuration Release \ No newline at end of file From e3f1214d644d87492f6e94b93d79a3b85e72e862 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 5 Sep 2019 01:22:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 278091a6..10e936d4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,8 +14,8 @@ - - + + \ No newline at end of file From 8d2a1c7356a3b249a0bba6bf89d15f5e5711af1f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 5 Sep 2019 13:58:06 +0800 Subject: [PATCH 5/5] refactor: rearrange file folder --- .gitignore | 2 +- Directory.Build.props | 4 ++-- src/admin/Bootstrap.Admin/Dockerfile | 2 +- src/admin/Bootstrap.Admin/Linux.Dockerfile | 2 +- src/admin/{ => keys}/Longbow.lic | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename src/admin/{ => keys}/Longbow.lic (100%) diff --git a/.gitignore b/.gitignore index c6b305e5..3f99431e 100644 --- a/.gitignore +++ b/.gitignore @@ -347,7 +347,7 @@ ASALocalRun/ **/[tT]humbs.db # Net Core Keys -[Kk]eys/ +**/[Kk]eys/*.xml Bootstrap.Admin.xml ###### -- Custom Ignore Section, Make sure all files you add to the git repo are below this line -- ###### diff --git a/Directory.Build.props b/Directory.Build.props index 10e936d4..9df49bac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,8 +14,8 @@ - - + + \ No newline at end of file diff --git a/src/admin/Bootstrap.Admin/Dockerfile b/src/admin/Bootstrap.Admin/Dockerfile index ee7219dc..9d5bfa4f 100644 --- a/src/admin/Bootstrap.Admin/Dockerfile +++ b/src/admin/Bootstrap.Admin/Dockerfile @@ -17,5 +17,5 @@ FROM base AS final WORKDIR /app COPY --from=publish /app . COPY --from=publish ["/src/Bootstrap.Admin/BootstrapAdmin.db", "./BootstrapAdmin.db"] -COPY --from=publish ["/src/Longbow.lic", "./Longbow.lic"] +COPY --from=publish ["/src/keys/Longbow.lic", "./Longbow.lic"] ENTRYPOINT ["dotnet", "Bootstrap.Admin.dll"] \ No newline at end of file diff --git a/src/admin/Bootstrap.Admin/Linux.Dockerfile b/src/admin/Bootstrap.Admin/Linux.Dockerfile index 59a4c78a..fe4ea758 100644 --- a/src/admin/Bootstrap.Admin/Linux.Dockerfile +++ b/src/admin/Bootstrap.Admin/Linux.Dockerfile @@ -17,5 +17,5 @@ FROM base AS final WORKDIR /app COPY --from=publish /app . COPY --from=publish ["/src/Bootstrap.Admin/BootstrapAdmin.db", "./BootstrapAdmin.db"] -COPY --from=publish ["/src/Longbow.lic", "./Longbow.lic"] +COPY --from=publish ["/src/keys/Longbow.lic", "./Longbow.lic"] ENTRYPOINT ["dotnet", "Bootstrap.Admin.dll"] \ No newline at end of file diff --git a/src/admin/Longbow.lic b/src/admin/keys/Longbow.lic similarity index 100% rename from src/admin/Longbow.lic rename to src/admin/keys/Longbow.lic