-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
29 lines (22 loc) · 870 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Use the official .NET SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app
# Copy entire solution and restore
COPY . .
RUN dotnet restore CryptoCoinBlock.sln
# Install EF Tools for Migrations
RUN dotnet tool install --global dotnet-ef
ENV PATH="$PATH:/root/.dotnet/tools"
# Run tests before proceeding
RUN dotnet test CM.Domain.Tests/CM.Domain.Tests.csproj --configuration Release --no-restore
RUN dotnet test CM.API.Tests/CM.API.Tests.csproj --configuration Release --no-restore
# Build the solution in Release mode
RUN dotnet build CryptoCoinBlock.sln -c Release -o /app/build
# Publish the project
RUN dotnet publish CryptoCoinBlock.sln -c Release -o /app/out
# Use runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 5555
ENTRYPOINT ["dotnet", "CryptoCoinBlock.dll"]