FROM debian:12-slim

# Install wget and xmlstarlet, an optimized xml parser. Then clear apt cache
RUN apt update && apt install -y --no-install-recommends \
    bash \
	wget \
    xmlstarlet \
    cron \
	&& rm -rf /var/lib/apt/lists/*
	
# Copy channel id list to data directory, cleaner script to opt directory
COPY xml_tv_ids.txt /data/
COPY xml_cleaner.sh /opt/

# Add the cron job
RUN echo "0 3 * * * /opt/xml_cleaner.sh" > /etc/cron.d/cleaner-cron-job
RUN chmod 0644 /etc/cron.d/cleaner-cron-job

CMD ["cron", "-f"]