# NOT_ON_SERV_START
# BiBiFi Docker Image - Handout
# NOT_ON_SERV_END

# 1) Build the Docker image:
#      docker build -f Dockerfile --tag bibifi .
# 2) Run the Docker container, mapping your current
#    directory into the `/connect` directory inside the container
#       docker run -v "$(PWD)/:/connect" -w /connect/ -it bibifi 
#    If the above line does not work, you may need to use `pwd` instead of `PWD`
#
# Note: If you are using a new Mac CPU (M1, M1 Pro, etc.), then when you run
# the commmands above, you should replace `build` with `build --platform linux/amd64`
# and `run` with `run --platform linux/amd64`

FROM ubuntu:24.04
ENV REFRESH_DATE="2026-01-05"

RUN apt-get update
RUN apt-get dist-upgrade -y

# install dependencies for autolab
RUN apt-get update && apt-get install -y build-essential gcc git make sudo less

# install dependencies for bibifi
RUN apt-get install -y python3
RUN apt-get install -y curl
RUN apt-get install -y software-properties-common
RUN apt-get install -y openssl
RUN apt-get install -y libprotobuf-dev libprotoc-dev protobuf-compiler
RUN apt-get install -y clang
RUN apt-get install -y cmake zlib1g-dev libcppunit-dev llvm gdb
RUN apt-get install -y libssl-dev libssh-dev
RUN apt-get install -y libffi-dev libcrypto++-dev
RUN apt-get install -y libmbedtls-dev
RUN apt-get install -y libnacl-dev
RUN apt-get install -y libsodium-dev
RUN apt-get install -y uthash-dev libjansson-dev libgcrypt-dev

# NOT_ON_SERV_START
# Install Infer
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN curl -sSL "https://github.com/facebook/infer/releases/download/v1.2.0/infer-linux-x86_64-v1.2.0.tar.xz" | tar -C /opt -xJ
RUN ln -s "/opt/infer-linux-x86_64-v1.2.0/bin/infer" /usr/local/bin/infer
RUN ln -s "/opt/infer-linux-x86_64-v1.2.0/bin/infer-explore" /usr/local/bin/infer-explore
# NOT_ON_SERV_END

RUN apt-get install -y dos2unix

# Clean up
RUN rm -rf /var/lib/apt/lists/*

# NOT_ON_SERV_START
RUN mkdir /connect
COPY . /connect
WORKDIR /connect
CMD "/bin/bash"
# NOT_ON_SERV_END
