39 lines
998 B
Docker
39 lines
998 B
Docker
# Build stage
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy csproj and restore as distinct layers
|
|
COPY *.csproj ./
|
|
RUN dotnet restore --runtime linux-arm64
|
|
|
|
# Copy everything else and build
|
|
COPY . .
|
|
RUN dotnet build "QRRapidoApp.csproj" -c Release --runtime linux-arm64 --no-restore
|
|
|
|
# Publish stage
|
|
FROM build AS publish
|
|
RUN dotnet publish "QRRapidoApp.csproj" -c Release -o /app/publish \
|
|
--runtime linux-arm64 \
|
|
--no-restore \
|
|
--no-build \
|
|
--self-contained false
|
|
|
|
# Final stage/image
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
|
WORKDIR /app
|
|
|
|
# Install libgdiplus for System.Drawing (se necessário para QR codes)
|
|
RUN apt-get update && apt-get install -y libgdiplus && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy published app
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Create non-root user
|
|
RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
|
|
USER appuser
|
|
|
|
# Set entry point
|
|
ENTRYPOINT ["dotnet", "QRRapidoApp.dll"] |