Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Integration #3

Closed
hgulamabbass opened this issue Aug 24, 2021 · 0 comments
Closed

Docker Integration #3

hgulamabbass opened this issue Aug 24, 2021 · 0 comments

Comments

@hgulamabbass
Copy link

Hi David, loved the standup about the minimal web api. It was really good.

How can you take the minimal webapi and put and run it in a Docker container? I tried it but get an error

#16 1.573 Microsoft (R) Build Engine version 17.0.0-preview-21378-03+d592862ed for .NET
#16 1.573 Copyright (C) Microsoft Corporation. All rights reserved.
#16 1.573
#16 3.747 Determining projects to restore...
#16 4.436 All projects are up-to-date for restore.
#16 4.740 You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
#16 10.34 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/tradehelperapi/TradeHelper.Api.csproj]
#16 11.24
#16 11.24 Build FAILED.
#16 11.24
#16 11.24 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/tradehelperapi/TradeHelper.Api.csproj]
#16 11.24 0 Warning(s)
#16 11.24 1 Error(s)
#16 11.24
#16 11.24 Time Elapsed 00:00:09.39

Below is my Docker FIle

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["TradeHelper.Api/TradeHelper.Api.csproj", "tradehelperapi/"]
RUN dotnet restore "tradehelperapi/TradeHelper.Api.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "tradehelperapi/TradeHelper.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "tradehelperapi/TradeHelper.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TradeHelper.Api.dll"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant