Skip to content

Commit

Permalink
add docker file to run on docker.
Browse files Browse the repository at this point in the history
  • Loading branch information
omid-ahmadpour committed Oct 2, 2021
1 parent 9cd945c commit 734e360
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
4 changes: 2 additions & 2 deletions src/Web/Api/Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<ItemGroup>

<Folder Include="Controllers\v2\" />
</ItemGroup>

<ItemGroup>
<Folder Include="Controllers\v2\" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions src/Web/Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#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
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["src/Web/Api/Api.csproj", "src/Web/Api/"]
COPY ["src/Web/ApiFramework/ApiFramework.csproj", "src/Web/ApiFramework/"]
COPY ["src/Infrastructure/Persistance/Persistance.csproj", "src/Infrastructure/Persistance/"]
COPY ["src/Core/Domain/Domain.csproj", "src/Core/Domain/"]
COPY ["src/Core/Application/Application.csproj", "src/Core/Application/"]
COPY ["src/Common/Common.csproj", "src/Common/"]
RUN dotnet restore "src/Web/Api/Api.csproj"
COPY . .
WORKDIR "/src/src/Web/Api"
RUN dotnet build "Api.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Api.dll"]
9 changes: 8 additions & 1 deletion src/Web/Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": true
}
}
}

0 comments on commit 734e360

Please sign in to comment.