FROM alpine:3.20

# Install FFmpeg, curl for health checks, and basic tools
RUN apk add --no-cache \
    ffmpeg \
    curl \
    bash

WORKDIR /app

# Copy playout scripts and configuration
COPY src/ /app/src/
COPY config/ /app/config/
COPY *.sh /app/

RUN chmod +x /app/*.sh

# Create directories for playlist and HLS output
RUN mkdir -p /app/playlist /app/hls

# Expose HLS directory (will be served by nginx)
VOLUME ["/app/hls"]

# Default command runs the playout loop
CMD ["./start-playout.sh"]