################################################################
# Begin section generated from template/Dockerfile.full.header
# This common file will be used by both Docker and the linux
# install script.
################################################################
ARG BASE="jammy"
FROM ubuntu:${BASE} as header

ENV DEBIAN_FRONTEND=noninteractive

# base tools and development stuff
RUN apt-get update && apt-get -y install \
    curl software-properties-common apt-utils \
    build-essential \
    cmake \
    ffmpeg \
    gcc \
    libcairo2-dev \
    libgirepository1.0-dev \
    pkg-config && \
    apt-get -y update && \
    apt-get -y upgrade

ARG NODE_VERSION=18
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --yes -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_"$NODE_VERSION".x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get install -y nodejs

# python native
RUN echo "Installing python."
RUN apt-get -y install \
    python3 \
    python3-dev \
    python3-pip \
    python3-setuptools \
    python3-wheel

# these are necessary for pillow-simd, additional on disk size is small
# but could consider removing this.
RUN echo "Installing pillow-simd dependencies."
RUN apt-get -y install \
    libjpeg-dev zlib1g-dev

# gstreamer native https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or-debian
RUN echo "Installing gstreamer."
RUN apt-get -y install \
    gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa \
    gstreamer1.0-vaapi

# python3 gstreamer bindings
RUN echo "Installing gstreamer bindings."
RUN apt-get -y install \
    python3-gst-1.0

# allow pip to install to system
RUN rm -f /usr/lib/python**/EXTERNALLY-MANAGED

RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install debugpy typing_extensions psutil

################################################################
# End section generated from template/Dockerfile.full.header
################################################################
