# Use a minimal base image with Perl FROM alpine:latest # Set a working directory WORKDIR /app # Install system dependencies and Perl RUN apk update && \ apk add --no-cache \ perl \ perl-app-cpanminus \ perl-lwp-useragent-determined \ perl-io-socket-ssl \ perl-net-ssleay \ perl-lwp-protocol-https \ make \ gcc \ musl-dev \ curl && \ \ # Install required Perl modules via CPAN cpanm --notest \ JSON::Tiny \ LWP::UserAgent \ LWP::Protocol::https \ Time::Duration \ URI::Escape \ Getopt::Std && \ \ # Clean up build dependencies and cache apk del make gcc musl-dev && \ rm -rf /var/cache/apk/* /root/.cpanm # Copy the Perl script into the container COPY poller.pl /app/poller.pl # Fix line endings and make the script executable RUN sed -i 's/\r$//' /app/poller.pl && \ chmod +x /app/poller.pl # Define the default command # Using perl explicitly and forcing unbuffered output CMD ["perl", "-u", "/app/poller.pl"]