36 lines
948 B
Docker
36 lines
948 B
Docker
# =====================================================================
|
|
# Dockerfile untuk ASP.NET Core Razor Pages .NET 10
|
|
# =====================================================================
|
|
# Multi-stage build:
|
|
# Stage 1: Build aplikasi
|
|
# Stage 2: Run production
|
|
# =====================================================================
|
|
|
|
# ---- STAGE 1: BUILD ----
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy csproj dan restore dependencies (cache layer)
|
|
COPY *.csproj .
|
|
RUN dotnet restore
|
|
|
|
# Copy semua source code dan build
|
|
COPY . .
|
|
RUN dotnet publish -c Release -o /app
|
|
|
|
# ---- STAGE 2: RUN ----
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
|
WORKDIR /app
|
|
|
|
# Copy hasil build dari stage 1
|
|
COPY --from=build /app .
|
|
|
|
# Set environment ke Production
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Jalankan aplikasi
|
|
ENTRYPOINT ["dotnet", "Indotalent.dll"] |