Structure
The docker file is at the root of the solution
Github Actions Code
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to Heroku Container registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Build
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:push -a easy2complyqa web
- name: push
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:push -a easy2complyqa web
- name: Release
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release -a easy2complyqa web
DOCKER FILE
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443
COPY ./*.sln ./common.props ./
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build WORKDIR /src COPY ["/src/VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj", "VuyisaTech.Easy2Comply.Web.Mvc/"] COPY ["/src/VuyisaTech.Easy2Comply.Web.Host/VuyisaTech.Easy2Comply.Web.Host.csproj", "VuyisaTech.Easy2Comply.Host/"] COPY ["/src/VuyisaTech.Easy2Comply.Core/VuyisaTech.Easy2Comply.Core.csproj", "VuyisaTech.Easy2Comply.Core/"] COPY ["src/VuyisaTech.Easy2Comply.Application/VuyisaTech.Easy2Comply.Application.csproj", "VuyisaTech.Easy2Comply.Application/"] COPY ["/src/VuyisaTech.Easy2Comply.Migrator/VuyisaTech.Easy2Comply.Migrator.csproj", "VuyisaTech.Easy2Comply.Migrator/"] COPY ["/src/VuyisaTech.Easy2Comply.Web.Core/VuyisaTech.Easy2Comply.Web.Core.csproj", "VuyisaTech.Easy2Comply.Web.Core/"] COPY ["/src/VuyisaTech.Easy2Comply.EntityFrameworkCore/VuyisaTech.Easy2Comply.EntityFrameworkCore.csproj", "VuyisaTech.Easy2Comply.EntityFrameworkCore/"] COPY ["/src/VuyisaTech.Easy2Comply.Web.Public/VuyisaTech.Easy2Comply.Web.Public.csproj", "VuyisaTech.Easy2Comply.Web.Public/"] COPY ["/src/VuyisaTech.Easy2Comply.Application.Shared/VuyisaTech.Easy2Comply.Application.Shared.csproj", "VuyisaTech.Easy2Comply.Application.Shared/"] COPY ["/src/VuyisaTech.Easy2Comply.Core.Shared/VuyisaTech.Easy2Comply.Core.Shared.csproj", "VuyisaTech.Easy2Comply.Core.Shared/"] COPY ["/src/VuyisaTech.Easy2Comply.GraphQL/VuyisaTech.Easy2Comply.GraphQL.csproj", "VuyisaTech.Easy2Comply.GraphQL/"]
RUN dotnet restore "VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj" COPY . .
WORKDIR "/src/VuyisaTech.Easy2Comply.Web.Mvc" RUN dotnet build "VuyisaTech.Easy2Comply.Web.Mvc.csproj" -c Release -o /app
FROM node:6.7.0 WORKDIR "/src/VuyisaTech.Easy2Comply.Web.Mvc" RUN npm install -g yarn RUN npm install -g npm run build
FROM build AS publish WORKDIR /src RUN dotnet publish "VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj" -c Release -o /app
FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "VuyisaTech.Easy2Comply.Web.Mvc.dll"]
ERROR
/src/VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj(2,3): error MSB4019: The imported project "/common.props" was not found. Confirm that the expression in the Import declaration "../../common.props" is correct, and that the file exists on disk. The command '/bin/sh -c dotnet publish "VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj" -c Release -o /app' returned a non-zero code: 1
ASSIST
What Am I doing wrong I have tried so many solutions and google is not helping
15 Answer(s)
-
0
-
0
NEW ERROR
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj]
-
0
hi robmasango
Does this error only exist in the ci pipeline?
-
0
Hi Maliming,
Yes it only exists in the CI pipeline
-
0
Hello robmasango,
Can you try changing the line after
RUN dotnet restore "VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj"
COPY . .
toCOPY . ./
-
0
Hi gterdem,
it is still giving me the same error
-
0
@robmasango
Is it possible for us to access your pipeline ?
-
0
@ismcagdas Yes it is can you please give me your credentials so that I can give you access.
-
0
Status
I managed to get the pipeleine working
Updated Pipeline (For those who would like to deploy to Heroku)
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base WORKDIR /app EXPOSE 80 EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build WORKDIR /src COPY ["src/VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj", "src/VuyisaTech.Easy2Comply.Web.Mvc/"] COPY ["src/VuyisaTech.Easy2Comply.Web.Core/VuyisaTech.Easy2Comply.Web.Core.csproj", "src/VuyisaTech.Easy2Comply.Web.Core/"] COPY ["src/VuyisaTech.Easy2Comply.Application/VuyisaTech.Easy2Comply.Application.csproj", "src/VuyisaTech.Easy2Comply.Application/"] COPY ["src/VuyisaTech.Easy2Comply.Application.Shared/VuyisaTech.Easy2Comply.Application.Shared.csproj", "src/VuyisaTech.Easy2Comply.Application.Shared/"] COPY ["src/VuyisaTech.Easy2Comply.Core.Shared/VuyisaTech.Easy2Comply.Core.Shared.csproj", "src/VuyisaTech.Easy2Comply.Core.Shared/"] COPY ["src/VuyisaTech.Easy2Comply.Core/VuyisaTech.Easy2Comply.Core.csproj", "src/VuyisaTech.Easy2Comply.Core/"] COPY ["src/VuyisaTech.Easy2Comply.EntityFrameworkCore/VuyisaTech.Easy2Comply.EntityFrameworkCore.csproj", "src/VuyisaTech.Easy2Comply.EntityFrameworkCore/"] COPY ["src/VuyisaTech.Easy2Comply.GraphQL/VuyisaTech.Easy2Comply.GraphQL.csproj", "src/VuyisaTech.Easy2Comply.GraphQL/"]
RUN dotnet restore "src/VuyisaTech.Easy2Comply.Web.Mvc/VuyisaTech.Easy2Comply.Web.Mvc.csproj"
COPY . .
WORKDIR "/src/src/VuyisaTech.Easy2Comply.Web.Mvc" RUN dotnet build "VuyisaTech.Easy2Comply.Web.Mvc.csproj" -c Release -o /app/build
FROM node:6.7.0 WORKDIR "/src/src/VuyisaTech.Easy2Comply.Web.Mvc" RUN npm install -g yarn RUN npm install -g npm run build
FROM build AS publish RUN dotnet publish "VuyisaTech.Easy2Comply.Web.Mvc.csproj" -c Release -o /app/publish
FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "VuyisaTech.Easy2Comply.Web.Mvc.dll"]
Deployed code Error (Heroku Logs)
2020-06-26T08:05:20.272878+00:00 app[web.1]: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) 2020-06-26T08:05:20.272878+00:00 app[web.1]: at Microsoft.AspNetCore.Hosting.WebHost.EnsureStartup() 2020-06-26T08:05:20.272879+00:00 app[web.1]: at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices() 2020-06-26T08:05:20.272879+00:00 app[web.1]: at Microsoft.AspNetCore.Hosting.WebHost.Initialize() 2020-06-26T08:05:20.272879+00:00 app[web.1]: at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() 2020-06-26T08:05:20.272880+00:00 app[web.1]: at VuyisaTech.Easy2Comply.Web.Startup.Program.Main(String[] args) in /src/src/VuyisaTech.Easy2Comply.Web.Mvc/Startup/Program.cs:line 12
-
0
After updating my appsettings.production.json
I am getting this error in hroku
2020-06-26T11:02:45.771756+00:00 heroku[web.1]: Starting process with command
dotnet VuyisaTech.Easy2Comply.Web.Mvc.dll
2020-06-26T11:03:45.976382+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launchWhat I have tried
Changing ENTRYPOINT ["dotnet", "VuyisaTech.Easy2Comply.Web.Mvc.dll"] to CMD ASPNETCORE_URLS=http://*:$PORT dotnet VuyisaTech.Easy2Comply.Web.Mvc.dll
Updated Error
2020-06-26T11:39:41.100896+00:00 heroku[web.1]: State changed from crashed to starting 2020-06-26T11:39:47.279030+00:00 heroku[web.1]: Starting process with command
/bin/sh -c ASPNETCORE_URLS\=http://\*:\39198\ dotnet\ VuyisaTech.Easy2Comply.Web.Mvc.dll
2020-06-26T11:40:47.772202+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2020-06-26T11:40:47.797802+00:00 heroku[web.1]: Stopping process with SIGKILL 2020-06-26T11:40:48.121946+00:00 heroku[web.1]: Process exited with status 137 2020-06-26T11:40:48.193619+00:00 heroku[web.1]: State changed from starting to crashedPlease assist
I think I am getting closer to a solution but I am stuck again please assist
-
0
Hi,
Can you invite;
- https://github.com/gterdem
- https://github.com/ismcagdas
-
0
Hi ismcagdas,
I have invited both users to my repo.
-
0
Thanks @robmasango, we will check it.
-
0
Hi @ismcgdas,
I havent received any feedback from you
-
0
Helloe @robmasango,
Heroku CI-CD pipeline is completely out of my scope, I am sorry. This seems a pipeline specific problem, if Azure gives support about CI-CD, Heroku should be providing too. Did you contact to Heroku about this or checked their forums about the pipeline error?