Init Git
This commit is contained in:
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# ---------- Build ----------
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# copy ไฟล์โครงการทีละตัวเพื่อ cache restore
|
||||
COPY AMREZ.EOP.sln ./
|
||||
COPY AMREZ.EOP.API/AMREZ.EOP.API.csproj AMREZ.EOP.API/
|
||||
COPY AMREZ.EOP.Application/AMREZ.EOP.Application.csproj AMREZ.EOP.Application/
|
||||
COPY AMREZ.EOP.Abstractions/AMREZ.EOP.Abstractions.csproj AMREZ.EOP.Abstractions/
|
||||
COPY AMREZ.EOP.Contracts/AMREZ.EOP.Contracts.csproj AMREZ.EOP.Contracts/
|
||||
COPY AMREZ.EOP.Domain/AMREZ.EOP.Domain.csproj AMREZ.EOP.Domain/
|
||||
COPY AMREZ.EOP.Infrastructures/AMREZ.EOP.Infrastructures.csproj AMREZ.EOP.Infrastructures/
|
||||
|
||||
RUN dotnet restore AMREZ.EOP.sln
|
||||
|
||||
# ค่อย copy ทั้ง repo แล้ว publish (ไม่ต้อง restore ซ้ำ)
|
||||
COPY . .
|
||||
RUN dotnet publish AMREZ.EOP.API/AMREZ.EOP.API.csproj -c Release -o /app/publish /p:UseAppHost=false --no-restore
|
||||
|
||||
# ---------- Runtime ----------
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
|
||||
WORKDIR /app
|
||||
# ให้ชัดเจน: Kestrel ฟังที่ 8080
|
||||
ENV ASPNETCORE_URLS=http://0.0.0.0:8080
|
||||
EXPOSE 8080
|
||||
|
||||
COPY --from=build /app/publish ./
|
||||
ENTRYPOINT ["dotnet", "AMREZ.EOP.API.dll"]
|
||||
Reference in New Issue
Block a user