FROM tsys-aios-gis-tools-gis-base:latest

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Install additional processing tools
RUN apt-get update && apt-get install -y \
    jupyter-notebook \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

# Install additional Python libraries for processing
RUN pip3 install --break-system-packages \
    jupyter \
    notebook \
    ipykernel \
    apache-airflow \
    prefect

# Set up Jupyter
RUN jupyter notebook --generate-config --allow-root --ip=0.0.0.0 --port=8888 --no-browser --notebook-dir=/workspace --NotebookApp.token='' --NotebookApp.password='' 2>/dev/null || true

# Create a working directory
WORKDIR /workspace

# Add entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Use the entrypoint script to handle user creation
ENTRYPOINT ["/entrypoint.sh"]