45 lines
1.2 KiB
Docker
45 lines
1.2 KiB
Docker
# Dockerfile for ASP.NET Core MVC on ARM64 (Ampere/OCI)
|
|
|
|
# Build stage
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy-arm64v8 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy csproj and restore dependencies
|
|
COPY ["CarneiroTech.csproj", "./"]
|
|
RUN dotnet restore "CarneiroTech.csproj" -a arm64
|
|
|
|
# Copy everything else and build
|
|
COPY . .
|
|
RUN dotnet build "CarneiroTech.csproj" -c Release -o /app/build -a arm64
|
|
|
|
# Publish stage
|
|
FROM build AS publish
|
|
RUN dotnet publish "CarneiroTech.csproj" -c Release -o /app/publish -a arm64 /p:UseAppHost=false
|
|
|
|
# Runtime stage
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-arm64v8 AS final
|
|
WORKDIR /app
|
|
|
|
# Install curl for health checks
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy published app
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Copy Content folder (markdown files) - already included in publish
|
|
# COPY Content ./Content
|
|
|
|
# Expose port
|
|
EXPOSE 5008
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:5008/ || exit 1
|
|
|
|
# Set environment variables
|
|
ENV ASPNETCORE_URLS=http://+:5008
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
|
|
# Run app
|
|
ENTRYPOINT ["dotnet", "CarneiroTech.dll"]
|