# 
# This is the Dockerfile for the initial setup of the
# vision_calibration project. It provides a clean, isolated
# environment for camera calibration research, including
# AprilTag-based extrinsics, intrinsics,  and experiments.
#
# BUILDING
# ===========================================================
#
#       docker build -t vision_calibration-base .
#
#
#
# CREATING THE CONTAINER
# ===========================================================
# 
# Use the below flags:
#
#       --gpus all: Grants the container access to the 
#                   GPUs on your system.
#
#       --privileged and -v /dev:/dev: Crucial for capturing 
#                   data streams from cameras (/dev/video*) and 
#                   communicating with the SO-101 motor controllers 
#                   (/dev/ttyUSB* or /dev/ttyACM*).
#
#       docker run -it \
#          --name vision_calibration \
#          --privileged \
#          --network host \
#          -v ~/code/robotics/vision_calibration/src:/app \
#          -v /dev:/dev \
#          vision_calibration-base bash
#
#
#
# DOCKER DEFINITION
# ===========================================================
FROM ubuntu:22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# System dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    build-essential \
    cmake \
    git \
    wget \
    unzip \
    pkg-config \
    libopencv-dev \
    python3-opencv \
    libatlas-base-dev \
    libjpeg-dev \
    libpng-dev \
    libtiff-dev \
    libavcodec-dev \
    libavformat-dev \
    libswscale-dev \
    libv4l-dev \
    libxvidcore-dev \
    libx264-dev \
    libgtk-3-dev \
    libcanberra-gtk3-module \
    && rm -rf /var/lib/apt/lists/*

# ------------------------------------------------------------
# Install Python packages
# ------------------------------------------------------------
# Python packages
RUN pip3 install --no-cache-dir \
    numpy \
    apriltag \
    opencv-contrib-python \
    pyrealsense2

# Workspace
WORKDIR /app

# Default command
CMD ["/bin/bash"]

