FROM ubuntu:22.04

# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC

# System dependencies
# Install Perl, system deps, and ffmpeg (includes ffprobe)
RUN apt update && apt install -y \
    libdbd-mysql-perl \
    libhttp-lite-perl \
    libjson-perl \
    libyaml-perl \
    perl \
    libdbi-perl \
    build-essential \
    ffmpeg \
    libstring-shellquote-perl \
    libwww-perl \
    liblwp-protocol-https-perl


RUN mkdir -p /app
ADD run.pl /app/run.pl
RUN chmod +x /app/run.pl
WORKDIR /app

# Default command: process tasks from the API until drained
CMD ["perl", "/app/run.pl"]
