Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .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
32 changes: 32 additions & 0 deletions Lagrange.Milky/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM alpine:3.23 AS base
USER root
USER $APP_UID
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
RUN apk update && apk add build-base
ARG BUILD_CONFIGURATION=Release
ARG GIT_SHA=Unknown
ENV DOCKER=true
WORKDIR /src
COPY ["Lagrange.Milky/Lagrange.Milky.csproj", "Lagrange.Milky/"]
COPY ["Lagrange.Codec/Lagrange.Codec.csproj", "Lagrange.Codec/"]
COPY ["Lagrange.Core/Lagrange.Core.csproj", "Lagrange.Core/"]
COPY ["Lagrange.Proto.Generator/Lagrange.Proto.Generator.csproj", "Lagrange.Proto.Generator/"]
COPY ["Lagrange.Proto/Lagrange.Proto.csproj", "Lagrange.Proto/"]
COPY ["Lagrange.Milky.Implementation.Api.Generator/Lagrange.Milky.Implementation.Api.Generator.csproj", "Lagrange.Milky.Implementation.Api.Generator/"]
RUN dotnet restore "Lagrange.Milky/Lagrange.Milky.csproj"
COPY . .
WORKDIR "/src/Lagrange.Milky"
RUN dotnet build "./Lagrange.Milky.csproj" -p:SourceRevisionId=$GIT_SHA -c $BUILD_CONFIGURATION -o /app/build

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

FROM base AS final
WORKDIR /app
ENV DOCKER=true
COPY --from=publish /app/publish .
WORKDIR /data
ENTRYPOINT ["/app/Lagrange.Milky"]
10 changes: 10 additions & 0 deletions Lagrange.Milky/Lagrange.Milky.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
<PropertyGroup Condition=" '$(DOCKER)' == 'true' ">
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug'">
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
Expand Down Expand Up @@ -33,4 +37,10 @@
<ItemGroup>
<EmbeddedResource Include="Resources\appsettings.jsonc" />
</ItemGroup>

<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
</Project>
Loading