Skip to content

Commit

Permalink
Added docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
vgotra committed Aug 8, 2024
1 parent 3a56c56 commit 2193e9d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*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
5 changes: 5 additions & 0 deletions src/EasyBlog.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyBlog", "EasyBlog\EasyBlog.csproj", "{C55433B8-A619-4A04-B56C-18D0951D791B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EBAD8FE8-DC2C-462D-B08D-E6068AE4E531}"
ProjectSection(SolutionItems) = preProject
docker-compose.yml = docker-compose.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
23 changes: 23 additions & 0 deletions src/EasyBlog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["EasyBlog/EasyBlog.csproj", "EasyBlog/"]
RUN dotnet restore "EasyBlog/EasyBlog.csproj"
COPY . .
WORKDIR "/src/EasyBlog"
RUN dotnet build "EasyBlog.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "EasyBlog.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "EasyBlog.dll"]
4 changes: 4 additions & 0 deletions src/EasyBlog/EasyBlog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
Expand All @@ -20,6 +21,9 @@

<ItemGroup>
<Content Update="appsettings.*.json" CopyToPublishDirectory="Never" />
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions src/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
easyblog:
image: easyblog
build:
context: .
dockerfile: EasyBlog/Dockerfile

0 comments on commit 2193e9d

Please sign in to comment.