-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathDockerfile.debug
More file actions
58 lines (44 loc) · 1.76 KB
/
Dockerfile.debug
File metadata and controls
58 lines (44 loc) · 1.76 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Debug Dockerfile for Document Translation Web Application
# This Dockerfile is optimized for debugging with VS Code
# Use the official ASP.NET Core runtime as the base image for debugging
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Install debugger tools
RUN apt-get update && apt-get install -y \
curl \
procps \
&& rm -rf /var/lib/apt/lists/*
# Install the debugger
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /remote_debugger
# Use the SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Debug
WORKDIR /src
# Copy project files
COPY ["DocumentTranslation.Web/DocumentTranslation.Web.csproj", "DocumentTranslation.Web/"]
COPY ["DocumentTranslationService/DocumentTranslationService.csproj", "DocumentTranslationService/"]
# Restore dependencies
RUN dotnet restore "DocumentTranslation.Web/DocumentTranslation.Web.csproj"
# Copy all source files
COPY . .
# Build the application in Debug mode
WORKDIR "/src/DocumentTranslation.Web"
RUN dotnet build "DocumentTranslation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
# Publish the application in Debug mode
FROM build AS publish
ARG BUILD_CONFIGURATION=Debug
RUN dotnet publish "DocumentTranslation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# Create the final debug image
FROM base AS final
WORKDIR /app
# Copy the published application
COPY --from=publish /app/publish .
# Set environment variables for development
ENV ASPNETCORE_ENVIRONMENT=Development
ENV ASPNETCORE_URLS=http://+:80
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
# Don't create a non-root user for debugging (easier debugging as root)
# USER appuser
ENTRYPOINT ["dotnet", "DocumentTranslation.Web.dll"]