From 6d22a22a6b581e86a7ec232165de62cc5913295e Mon Sep 17 00:00:00 2001 From: Darren Reid Date: Fri, 26 Feb 2021 17:12:13 +1100 Subject: [PATCH] Update CI process --- .github/workflows/release.yml | 6 +----- Dockerfile | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2dcf19..905d3b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,10 +8,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - - - name: dotnet publish - run: | - dotnet publish ./VuetifySpaTemplate/ -o publish -c release -r linux-x64 - name: repository name fix run: echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV @@ -26,7 +22,7 @@ jobs: - name: Build and push Docker images uses: docker/build-push-action@v2.2.2 with: - file: VuetifySpaTemplate/Dockerfile + file: Dockerfile context: . push: true tags: ghcr.io/${{ env.image_repository_name }}:${{ github.event.release.tag_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7da66ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /source + +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ + && apt-get install -y --no-install-recommends nodejs \ + && echo "node version: $(node --version)" \ + && echo "npm version: $(npm --version)" \ + && rm -rf /var/lib/apt/lists/* + +COPY VuetifySpaTemplate/package.json . +COPY VuetifySpaTemplate/npm-shrinkwrap.json . + +RUN npm --prefix VuetifySpaTemplate install + +COPY . . +RUN dotnet restore + +WORKDIR /source/VuetifySpaTemplate +RUN dotnet publish -c release -o /app --no-restore + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime +WORKDIR /app +COPY --from=build /app ./ +ENTRYPOINT ["dotnet", "VuetifySpaTemplate.dll"] \ No newline at end of file