Skip to content

Commit

Permalink
update dockerfiles, use recommended build props for running in contai…
Browse files Browse the repository at this point in the history
…ners
  • Loading branch information
hahn-kev committed Oct 19, 2023
1 parent 660fb89 commit 0b7b891
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
13 changes: 9 additions & 4 deletions backend/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<Project>
<PropertyGroup Condition="$(DockerDev) == 'true'">
<IntermediateOutputPath>/app/obj/</IntermediateOutputPath>
<OutputPath>/app/bin/</OutputPath>
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);$(MSBuildProjectDirectory)/obj/**/*</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);$(MSBuildProjectDirectory)/bin/**/*</DefaultItemExcludes>
</PropertyGroup>

<PropertyGroup Condition="'$(DOTNET_RUNNING_IN_CONTAINER)' == 'true'">
<BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/obj/container/</BaseIntermediateOutputPath>
<BaseOutputPath>$(MSBuildProjectDirectory)/bin/container/</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.6.40" PrivateAssets="all"/>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.7.30" PrivateAssets="all"/>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

COPY . .
# WORKDIR /src
Expand Down
3 changes: 1 addition & 2 deletions backend/LexBoxApi/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
EXPOSE 80
EXPOSE 443
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
Expand All @@ -14,5 +14,4 @@ RUN for file in $(ls *.csproj); do dir=${file%.*} mkdir -p ${file%.*}/ && mv $fi
COPY . .
WORKDIR /src/backend/LexBoxApi
RUN mkdir /src/frontend
ENV DockerDev=true
CMD dotnet watch run -lp docker --property:InformationalVersion=dockerDev
1 change: 0 additions & 1 deletion backend/LexData/LexData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0-rc.1.23419.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Update="Microsoft.VisualStudio.Threading.Analyzers" Version="17.7.30" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 0b7b891

Please sign in to comment.