30 lines
886 B
Docker
30 lines
886 B
Docker
# مرحله 1: Build
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
|
WORKDIR /app
|
|
|
|
# کپی فایلهای پروژه به دایرکتوری کاری
|
|
COPY ["Complex.EndPoint/Complex.EndPoint.csproj", "Complex.EndPoint/"]
|
|
|
|
# بازیابی پکیجها
|
|
RUN dotnet restore "Complex.EndPoint/Complex.EndPoint.csproj"
|
|
|
|
# کپی بقیه کدهای پروژه
|
|
COPY . .
|
|
|
|
# ساخت پروژه با حالت Release
|
|
RUN dotnet publish "Complex.EndPoint/Complex.EndPoint.csproj" -c Release -o /app/publish
|
|
|
|
# مرحله 2: Runtime
|
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
|
|
WORKDIR /app
|
|
|
|
# کپی خروجی Publish از مرحله Build
|
|
COPY --from=build /app/publish .
|
|
|
|
EXPOSE 80
|
|
# تعیین نقطه شروع کانتینر
|
|
ENTRYPOINT ["dotnet", "Complex.EndPoint.dll"]
|
|
|
|
# مشخص کردن پورت (اگر پروژه روی 80 یا 5000 است آن را تنظیم کن)
|
|
|