Change Dockerfile
All checks were successful
Build & Deploy Checkin Service / build (push) Successful in 24s

This commit is contained in:
Suphonchai Phoonsawat 2026-06-23 11:45:28 +07:00
parent 65ca175f98
commit f6c8b4f754

View file

@ -21,6 +21,7 @@
#ARG BUILD_CONFIGURATION=Release #ARG BUILD_CONFIGURATION=Release
#RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false #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) ## 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 #FROM base AS final
#WORKDIR /app #WORKDIR /app
@ -29,17 +30,18 @@
# ใช้ official .NET SDK image สำหรับการ build # ใช้ official .NET SDK image สำหรับการ build
# Note: Build context = repository root (ตามที่ GitHub Actions ใช้)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# กำหนด working directory ภายใน container
WORKDIR /src WORKDIR /src
# copy เฉพาะ .csproj ก่อน เพื่อใช้ layer caching (restore เร็ว เก็บ cache นาน) # 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" RUN dotnet restore "BMA.EHR.CheckInConsumer.csproj"
# คัดลอก source ที่เหลือแล้ว publish # คัดลอก source ที่เหลือแล้ว publish
COPY . ./ COPY BMA.EHR.CheckInConsumer/ ./
RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/publish /p:UseAppHost=false RUN dotnet publish "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/publish /p:UseAppHost=false
# ใช้ stage ใหม่สำหรับ runtime (image เล็กลง) # ใช้ stage ใหม่สำหรับ runtime (image เล็กลง)