Files
tetri5/backend/Dockerfile

28 lines
647 B
Docker

# ---- 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"]