# Use Ubuntu 18.04 as the base image
FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04

ARG https_proxy
ARG http_proxy
ARG all_proxy

RUN apt-get update


# Update the package list and install basic development tools
RUN apt-get install -y --no-install-recommends build-essential
RUN apt-get install -y --no-install-recommends software-properties-common
RUN apt-get install -y --no-install-recommends wget
RUN apt-get install -y --no-install-recommends curl
RUN apt-get install -y --no-install-recommends git
RUN apt-get install -y --no-install-recommends vim

# Install CMake
RUN apt-get install -y --no-install-recommends

# Install CMake 3.20.6
RUN cd /opt && \
    wget https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6-linux-x86_64.tar.gz && \
    tar -zxvf cmake-3.20.6-linux-x86_64.tar.gz && \
    ln -s /opt/cmake-3.20.6-linux-x86_64/bin/* /usr/local/bin/ && \
    rm cmake-3.20.6-linux-x86_64.tar.gz

# Clean temporary files to reduce image size
RUN apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /workspace

# Default to running Bash
CMD ["/bin/bash"]
