Skip to content

Commit

Permalink
Cleanup Dockerfiles, add Dockerfile.dev that utilizes dotnet watch
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinki14 committed Aug 3, 2021
1 parent cd5fe24 commit 32db287
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
15 changes: 3 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR .
COPY ["src/OSItemIndex.API/OSItemIndex.API.csproj", "src/OSItemIndex.API/"]
COPY ["src/OSItemIndex.Data/OSItemIndex.Data.csproj", "src/OSItemIndex.Data/"]
RUN dotnet restore "src/OSItemIndex.API/OSItemIndex.API.csproj"
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS publish
WORKDIR /app
COPY . .
WORKDIR "/src/OSItemIndex.API"
RUN dotnet build "OSItemIndex.API.csproj" -c Release -o /app/build

FROM build AS publish
WORKDIR /app/src/OSItemIndex.API
RUN dotnet publish "OSItemIndex.API.csproj" -c Release -o /app/publish

FROM base AS final
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS base

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS publish
WORKDIR /app
COPY . .
WORKDIR /app/src/OSItemIndex.API
RUN dotnet restore

FROM base AS final
WORKDIR /app
COPY --from=publish /app/src .
ENTRYPOINT ["dotnet", "watch", "run", "-p", "OSItemIndex.API"]
2 changes: 2 additions & 0 deletions OSItemIndex.API.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ ProjectSection(SolutionItems) = preProject
Dockerfile = Dockerfile
..\.env = ..\.env
..\docker-compose.dev.yml = ..\docker-compose.dev.yml
.dockerignore = .dockerignore
Dockerfile.dev = Dockerfile.dev
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSItemIndex.API", "src\OSItemIndex.API\OSItemIndex.API.csproj", "{37059DD7-E108-44FC-9EFC-41BFC92F338B}"
Expand Down

0 comments on commit 32db287

Please sign in to comment.