diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23ddb6b..359ea7c 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 ./ScriptTemplate/ -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: ScriptTemplate/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..846b7ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /source + +COPY . . +RUN dotnet restore + +WORKDIR /source/ScriptTemplate +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", "ScriptTemplate.dll"] \ No newline at end of file