FROM oven/bun:1.2.23-debian

ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3100
ENV AGENT_CONFIG=/app/agent.config.json
ENV WORKSPACE_ROOT=/workspace

WORKDIR /app

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    ca-certificates \
    wget \
    sudo \
    python3 \
    python3-pip \
    python3-gi \
    gir1.2-gstreamer-1.0 \
    gir1.2-gst-plugins-base-1.0 \
    gstreamer1.0-tools \
    gstreamer1.0-plugins-base \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad \
    gstreamer1.0-plugins-ugly \
    v4l-utils \
  && python3 -m pip install --break-system-packages --no-cache-dir websockets \
  && rm -rf /var/lib/apt/lists/*

COPY package.json bun.lock ./
RUN bun install --production --frozen-lockfile

COPY agent.config.json ./
COPY src ./src
COPY public ./public
COPY scripts ./scripts
COPY ros_bridge ./ros_bridge

EXPOSE 3100

CMD ["bun", "run", "start"]
