diff --git a/BMA.EHR.CheckInConsumer/Dockerfile b/BMA.EHR.CheckInConsumer/Dockerfile index 314f1b71..81c430d9 100644 --- a/BMA.EHR.CheckInConsumer/Dockerfile +++ b/BMA.EHR.CheckInConsumer/Dockerfile @@ -21,6 +21,7 @@ #ARG BUILD_CONFIGURATION=Release #RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false # + ## This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) #FROM base AS final #WORKDIR /app @@ -29,17 +30,18 @@ # ใช้ official .NET SDK image สำหรับการ build +# Note: Build context = repository root (ตามที่ GitHub Actions ใช้) FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -# กำหนด working directory ภายใน container WORKDIR /src # copy เฉพาะ .csproj ก่อน เพื่อใช้ layer caching (restore เร็ว เก็บ cache นาน) -COPY BMA.EHR.CheckInConsumer.csproj ./ +COPY BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj ./BMA.EHR.CheckInConsumer/ +WORKDIR /src/BMA.EHR.CheckInConsumer RUN dotnet restore "BMA.EHR.CheckInConsumer.csproj" # คัดลอก source ที่เหลือแล้ว publish -COPY . ./ +COPY BMA.EHR.CheckInConsumer/ ./ RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/publish /p:UseAppHost=false # ใช้ stage ใหม่สำหรับ runtime (image เล็กลง)