FROM microsoft/dotnet:2.1-sdk-alpine AS builder
WORKDIR /app

COPY ./Sources ./

RUN dotnet build

RUN cd DeStream.DeStreamD \
    && dotnet publish -c Release --framework netcoreapp2.1 --runtime alpine-x64 -o out

FROM microsoft/dotnet:2.1-runtime-alpine
WORKDIR /app
COPY --from=builder /app/DeStream.DeStreamD/out .

ENTRYPOINT ["dotnet", "DeStream.DeStreamD.dll"]