52 lines
1.8 KiB
Docker
52 lines
1.8 KiB
Docker
# ========================================================
|
|
# Build Stage
|
|
# ========================================================
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy solution and project files for layer caching
|
|
COPY GsDChat.slnx ./
|
|
COPY src/GsDChat.Core/GsDChat.Core.csproj src/GsDChat.Core/
|
|
COPY src/GsDChat.Modding/GsDChat.Modding.csproj src/GsDChat.Modding/
|
|
COPY src/GsDChat.Server/GsDChat.Server.csproj src/GsDChat.Server/
|
|
COPY src/GsDChat.Mods.SampleBot/GsDChat.Mods.SampleBot.csproj src/GsDChat.Mods.SampleBot/
|
|
|
|
# Restore dependencies
|
|
RUN dotnet restore src/GsDChat.Server/GsDChat.Server.csproj
|
|
RUN dotnet restore src/GsDChat.Mods.SampleBot/GsDChat.Mods.SampleBot.csproj
|
|
|
|
# Copy source tree
|
|
COPY src/ ./src/
|
|
|
|
# Publish GsDChat Server
|
|
RUN dotnet publish src/GsDChat.Server/GsDChat.Server.csproj -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
# Publish SampleBot reference mod
|
|
RUN dotnet publish src/GsDChat.Mods.SampleBot/GsDChat.Mods.SampleBot.csproj -c Release -o /app/mod_publish /p:UseAppHost=false
|
|
|
|
# Place default mod in published mods directory
|
|
RUN mkdir -p /app/publish/mods && cp /app/mod_publish/GsDChat.Mods.SampleBot.dll /app/publish/mods/
|
|
|
|
# ========================================================
|
|
# Runtime Stage
|
|
# ========================================================
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
|
WORKDIR /app
|
|
|
|
# Copy published application
|
|
COPY --from=build /app/publish .
|
|
|
|
# Create persistence directories for database, files, and mods
|
|
RUN mkdir -p /app/data /app/mods
|
|
|
|
# Configure default container environment
|
|
ENV ASPNETCORE_URLS=http://+:5000
|
|
ENV GSDCHAT_SETTINGS_FILE=/app/serversettings.json
|
|
ENV GSDCHAT_DATA_DIR=/app/data
|
|
ENV GSDCHAT_MODS_DIR=/app/mods
|
|
|
|
EXPOSE 5000
|
|
|
|
VOLUME ["/app/data", "/app/mods"]
|
|
|
|
ENTRYPOINT ["dotnet", "GsDChat.Server.dll"]
|