Skip to content

Commit

Permalink
Create Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
raghav2404 authored Dec 14, 2024
1 parent f59890a commit 49ebcc1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Use the official .NET SDK image for building the solution
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

# Set the working directory
WORKDIR /src

# Copy the solution and all projects into the container
COPY ["demoMvcCore.sln", "./"]
COPY ["/CoreBusiness.csproj", "CoreBusiness/"]
COPY ["/demoMvcCore.csproj","demoMvcCore/"]
COPY ["/UseCases.csproj", "UseCases/"]
COPY ["Plugins.DataStore.SQL/Plugins.DataStore.SQL.csproj", "Plugins.DataStore,SQL/"]

# Restore dependencies for all projects in the solution
RUN dotnet restore demoMvcCore.sln

# Copy all source files into the container
COPY . .

# Build the solution in Release mode
RUN dotnet build demoMvcCore.sln --configuration Release --no-restore

# Publish the Web API project (the entry point)
FROM build AS publish
RUN dotnet publish demoMvcCore/demoMvcCore.csproj --configuration Release --output /app/publish --no-build

# Use the .NET runtime image to run the app
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final

# Set the working directory in the container
WORKDIR /app

# Copy the published output from the build container
COPY --from=publish /app/publish .

# Expose the port the app will run on
EXPOSE 80

# Set the entry point to start the Web API application
ENTRYPOINT ["dotnet", "demoMvcCore.dll"]

0 comments on commit 49ebcc1

Please sign in to comment.