Skip to content

Commit 50cd417

Browse files
Merge pull request #9 from IseduardoRezende/dev-eduardo
✨feat: Add Dockerfile
2 parents 17b738f + 9051c0f commit 50cd417

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md
26+
!**/.gitignore
27+
!.git/HEAD
28+
!.git/config
29+
!.git/packed-refs
30+
!.git/refs/heads/**

AutoDoc.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
<DockerfileContext>.</DockerfileContext>
810
</PropertyGroup>
911

1012
<ItemGroup>
@@ -27,6 +29,7 @@
2729
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.8" />
2830
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.8" />
2931
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.8" />
32+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
3033
</ItemGroup>
3134

3235
</Project>

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This phase is used when running in VS in fast mode (Default for Debug configuration)
2+
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base
3+
USER $APP_UID
4+
WORKDIR /app
5+
6+
# This phase is used to compile the service project
7+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
8+
ARG BUILD_CONFIGURATION=Release
9+
WORKDIR /src
10+
COPY ["AutoDoc.csproj", "."]
11+
RUN dotnet restore "./AutoDoc.csproj"
12+
COPY . .
13+
WORKDIR "/src/."
14+
RUN dotnet build "./AutoDoc.csproj" -c $BUILD_CONFIGURATION -o /app/build
15+
16+
# This phase is used to publish the service project to be copied to the final phase
17+
FROM build AS publish
18+
ARG BUILD_CONFIGURATION=Release
19+
RUN dotnet publish "./AutoDoc.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
20+
21+
# This phase is used in production or when running in VS in normal mode (default when not using Debug configuration)
22+
FROM base AS final
23+
WORKDIR /app
24+
COPY --from=publish /app/publish .
25+
ENTRYPOINT ["dotnet", "AutoDoc.dll"]

Properties/launchSettings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"profiles": {
3+
"AutoDoc": {
4+
"commandName": "Project"
5+
},
6+
"Container (Dockerfile)": {
7+
"commandName": "Docker"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)