-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
29 lines (25 loc) · 911 Bytes
/
Copy pathdockerfile
File metadata and controls
29 lines (25 loc) · 911 Bytes
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
# Stage 1: Restore dependencies (uses .NET SDK)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS restore-stage
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet publish -c Debug -o out
## Run migrations
FROM restore-stage as migrations
RUN dotnet tool install --global dotnet-ef
ENV PATH="$PATH:/root/.dotnet/tools"
RUN dotnet-ef database update --project /app
# Stage 2: Build the image (doesn't require .NET SDK)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
COPY --from=restore-stage /app/out .
# Install the .NET Core debugger
RUN apt-get update \
&& apt-get install -y --no-install-recommends unzip curl \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /remote_debugger \
&& ls -la /remote_debugger
# Set the working directory for the application
WORKDIR /app
# Start the application
CMD ["dotnet", "PostRedisApi.dll"]