-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐳 Added Dockerfile to Web API project
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Use the official .NET SDK image | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env | ||
|
||
# Set the working directory in the container | ||
WORKDIR /App | ||
|
||
# Copy the project file and restore dependencies | ||
COPY ./src/EcoLink.WebApi/EcoLink.WebApi.csproj ./src/EcoLink.WebApi/ | ||
RUN dotnet restore ./src/EcoLink.WebApi/EcoLink.WebApi.csproj | ||
|
||
# Copy the remaining files | ||
COPY . . | ||
|
||
# Publish the application | ||
RUN dotnet publish -c Release -o out | ||
|
||
# Build the runtime image | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 | ||
WORKDIR /App | ||
COPY --from=build-env /App/out . | ||
EXPOSE 5000 | ||
ENV ASPNETCORE_URLS=http://+:5000 | ||
ENTRYPOINT ["dotnet", "EcoLink.WebApi.dll"] |