feat: add docker support for backend

This commit is contained in:
2025-07-29 02:07:59 -04:00
parent 5d861a34e9
commit d0a6cb3f2a
2 changed files with 29 additions and 2 deletions

27
backend/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# ---- Build Stage ----
FROM mcr.microsoft.com/dotnet/sdk:9.0.302-alpine3.22 AS build
WORKDIR /app
# Copy project file and restore dependencies
COPY backend.csproj ./
RUN dotnet restore
# Copy all source files and publish
COPY . ./
RUN dotnet publish backend.csproj -c Release -o /app/out
# ---- Runtime Stage ----
FROM mcr.microsoft.com/dotnet/aspnet:9.0.7-bookworm-slim AS runtime
WORKDIR /app
# Copy published output from build stage
COPY --from=build /app/out ./
# Expose the WebSocket port
EXPOSE 5151
# Bind to all network interfaces on port 5151
ENV ASPNETCORE_URLS=http://+:5151
# Start the app
ENTRYPOINT ["dotnet", "backend.dll"]

View File

@@ -97,5 +97,5 @@ color:
piece-ghost: "#9BFCF0"
online:
server-url: "ws://localhost:5085"
#server-url: "ws://localhost:5001"
#server-url: "ws://localhost:5151"
server-url: "wss://api.tetris.onl"