Skip to content

Commit

Permalink
🐳 Added Dockerfile to Web API project
Browse files Browse the repository at this point in the history
  • Loading branch information
muqimjon committed Jan 19, 2024
1 parent 9f0e9dc commit 0890f4b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,9 @@ MigrationBackup/

# Fody - auto-generated XML schema
FodyWeavers.xsd


# C# / .NET
/src/EcoLink.Bot/appsettings.Development.json
/src/EcoLink.WebApi/appsettings.Development.json
/appsettings.Development.json
23 changes: 23 additions & 0 deletions src/EcoLink.WebApi/Dockerfile
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"]

0 comments on commit 0890f4b

Please sign in to comment.