Files
profilarr/Dockerfile.parser

62 lines
2.0 KiB
Docker

# =============================================================================
# Profilarr Parser Dockerfile
# =============================================================================
# .NET 8.0 microservice for parsing release titles
# This service is OPTIONAL - only needed for custom format/quality profile testing
#
# Build: docker build -f Dockerfile.parser -t profilarr-parser .
# Run: docker run -p 5000:5000 profilarr-parser
# -----------------------------------------------------------------------------
# Stage 1: Build
# -----------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder
WORKDIR /build
# Copy project file first for better layer caching
COPY src/services/parser/Parser.csproj ./
RUN dotnet restore
# Copy source and build
COPY src/services/parser/ ./
# Remove local build config (uses paths that don't exist in container)
RUN rm -f Directory.Build.props && dotnet publish -c Release -o /app --no-restore
# -----------------------------------------------------------------------------
# Stage 2: Runtime
# -----------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
# Labels for container metadata
LABEL org.opencontainers.image.title="Profilarr Parser"
LABEL org.opencontainers.image.description="Release title parser for Profilarr (optional)"
LABEL org.opencontainers.image.source="https://github.com/Dictionarry-Hub/profilarr"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
WORKDIR /app
# Copy built application
COPY --from=builder /app ./
# Create non-root user
RUN addgroup -g 1000 parser && \
adduser -u 1000 -G parser -D -h /app parser
# Switch to non-root user
USER parser
# Environment variables
ENV ASPNETCORE_URLS=http://+:5000
ENV ASPNETCORE_ENVIRONMENT=Production
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:5000/health || exit 1
# Run the application
ENTRYPOINT ["dotnet", "Parser.dll"]