nakib / elphbolt

A solver for the coupled and decoupled electron and phonon Boltzmann transport equations.
GNU General Public License v3.0
39 stars 26 forks source link

Update Dockerfile #106 #107

Closed Rajdeep1311 closed 1 year ago

nakib commented 1 year ago

Dear Rajdeep,

Thanks a lot for your PR. There might be a slight confusion here. By fpm, I meant the fortran package manager. By the way, I am also fine with the cmake option, though fpm is preferred.

Best regards, Nakib

Rajdeep1311 commented 1 year ago

Use an appropriate base image with a Fortran compiler (e.g., gfortran) and FPM installed.

FROM debian:buster

User name

ENV USERNAME=elf

Select and set time zone

ENV TZ=Europe/Madrid RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Update software repo

RUN apt-get update

Upgrade OS

RUN apt-get upgrade -yq && apt-get dist-upgrade -yq

Install sudo

RUN apt-get install -yq sudo

Create, give sudo powers, and switch to user "elf"

RUN echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ useradd --no-log-init --home-dir /home/$USERNAME --create-home --shell /bin/bash $USERNAME && \ adduser $USERNAME sudo

Set user name and work directory

USER $USERNAME WORKDIR /home/$USERNAME

Install some other packages from Debian repo

RUN sudo apt-get install -yq git nano make cmake gfortran mpich \ liblapack-dev libsymspg-dev && \ sudo apt-get clean -q

Install FPM

RUN sudo apt-get install -yq ruby && \ sudo gem install fpm

Create a directory for your Fortran project

RUN mkdir my_fortran_project

Copy your Fortran project files (FPM.toml, source code, etc.) into the container

COPY . /home/$USERNAME/my_fortran_project

Set the working directory to your Fortran project directory

WORKDIR /home/$USERNAME/my_fortran_project

Use FPM to build and install your Fortran project

RUN fpm build && \ fpm install

Optionally, you can run your Fortran application here

CMD ["./your_fortran_executable"]

Sir Is this alright?

nakib commented 1 year ago

Hi Rajdeep,

Thanks a lot for the update. Unfortunately, I still don't think this will work. By the way, have you tried building this image on your machine?

To be specific about the issue, with the following command, you are installing a different fpm than the one needed here:

RUN sudo apt-get install -yq ruby &&
sudo gem install fpm

You can try the cmake route, which would be simpler as you can simply apt get it. Following this, building OpenCoarrays, and cloning elphbolt, you can simply mkdir build; cd build; cmake ..; make; ctest.

Best regards, Nakib

Rajdeep1311 commented 1 year ago

I will try my best to help you sir

nakib commented 1 year ago

Hi Rajdeep,

I have updated the Dockerfile to use cmake and have closed the issue.

Best regards, Nakib