diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f9a510..6a22cf0 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 ./MvcAuthTemplate/ -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: MvcAuthTemplate/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..72bdd1d --- /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 MvcAuthTemplate/package.json . +COPY MvcAuthTemplate/npm-shrinkwrap.json . + +RUN npm --prefix MvcAuthTemplate install + +COPY . . +RUN dotnet restore + +WORKDIR /source/MvcAuthTemplate +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", "MvcAuthTemplate.dll"] \ No newline at end of file