#-*- mode:sh -*- # A Dockerfile to enable MCNP development # # Author: Sriram Swaminarayan # Date: March 14, 2025 # # How to in three steps: # Build (once) - Initialize (once) - Attach (every time) # # 1: Build Image (once): # export USERNAME=$(whoami) UID=$(id -u) # docker build -t bash . --build-arg UID=${UID} --build-arg USERNAME=${USERNAME} # # 2: Instantiate container (once): # xhost +localhost # export USERNAME=$(whoami) # docker run --ulimit nofile=65536:65536 --name mcnp6 -v /Users/${USERNAME}:/Users/${USERNAME} -it bash # # 3: Attach to container (every time): # xhost +localhost; docker start mcnp6; docker attach mcnp6 # # -----BEGIN DOCKER BUILD----- # uses the latest ubuntu image FROM ubuntu:latest # Command line arguments ARG UID ARG USERNAME # X11 forwarding to host ENV DISPLAY="host.docker.internal:0" CMD ["/bin/bash"] # Create appropriate user RUN mkdir -p /Users RUN useradd -G sudo -s /bin/bash -u ${UID} -d /Users/${USERNAME} ${USERNAME} RUN passwd -d ${USERNAME} # Generic dependencies RUN env RUN apt-get update && \ apt-get install -y \ build-essential \ cmake \ cmake-curses-gui \ ddd \ emacs \ g++-13 \ gcc-13 \ gdb \ gfortran-13 \ git \ libhdf5-dev \ make \ mpich \ net-tools \ perl \ python3 \ qt6-base-dev \ sudo \ util-linux \ vim \ x11-apps # Switch to user and space USER ${USERNAME} WORKDIR /Users/${USERNAME}