feat: add docker support for backend
This commit is contained in:
27
backend/Dockerfile
Normal file
27
backend/Dockerfile
Normal 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"]
|
||||||
@@ -97,5 +97,5 @@ color:
|
|||||||
piece-ghost: "#9BFCF0"
|
piece-ghost: "#9BFCF0"
|
||||||
|
|
||||||
online:
|
online:
|
||||||
server-url: "ws://localhost:5085"
|
#server-url: "ws://localhost:5151"
|
||||||
#server-url: "ws://localhost:5001"
|
server-url: "wss://api.tetris.onl"
|
||||||
|
|||||||
Reference in New Issue
Block a user