FROM node:18-bookworm-slim

# Install PipeWire, WirePlumber, PulseAudio compat, ALSA, and D-Bus
RUN apt-get update && apt-get install -y \
    pipewire \
    pipewire-pulse \
    pipewire-alsa \
    wireplumber \
    dbus-x11 \
    git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Clone and build the PipeWire Web Remote interface
RUN git clone https://github.com/oudeis01/pipewire-web-remote.git . \
    && npm install \
    && npm run build

COPY start.sh /start.sh
RUN chmod +x /start.sh

# The Web UI defaults to 8080
EXPOSE 8080

CMD ["/start.sh"]
