i2bc / SURFMAP

Other
20 stars 3 forks source link

[FEATURE]: Can the Dockerfile used to create the referenced docker image be added to the repo? #25

Open brspurri opened 2 months ago

brspurri commented 2 months ago

Feature Title

Dockerfile

Feature Summary

Can the Dockerfile used to create the referenced docker image be added to the repo? It would be very useful as I need to recreate the image with a minor modification.

Motivation and Context

Currently, the docker image cannot be recreated.

Technical Details and Implementation

No response

Duplicate Check

nchenche commented 2 months ago

Hi @brspurri,

You will find below the Dockerfile instructions. It's been a long time since I have not seen it, so it certainly is optimizable.

Also, before running the Dockerfile,you will need to create a softwares directory where you must add APBS-3.4.1 (from https://github.com/Electrostatics/apbs/releases/tag/v3.4.1).

├── CHANGELOG.md

├── doc
├── Dockerfile
├── LICENSE
├── MANIFEST.in
├── README.md
├── setup.py
├── softwares
        └── APBS-3.4.1.Linux
├── surfmap

Dockerfile

# 1st build stage: base image for ubuntu
#################
FROM ubuntu:22.04 as base_os_ubuntu

# to not the user being asked validations upon install process 
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y \
    software-properties-common \
    && add-apt-repository ppa:deadsnakes/ppa 

RUN apt-get update && apt-get install -y \
    build-essential \
    fort77 \
    gcc-11 \
    less \
    vim-tiny 

# 2nd build stage: add R
#################
FROM base_os_ubuntu as base_os_with_r

RUN apt-get update && apt-get install -y \
    r-base

# 3rd build stage: add python3.10
#################
FROM base_os_with_r as base_os_with_python

RUN apt-get update && apt-get install -y \
    python3.10 \
    python3-pip

# 4th build stage: add R library dependencies
#################
FROM base_os_with_python as base_os_with_r_lib
RUN R -e "install.packages(c('optparse', 'data.table', 'mapproj'))"

# 5th build stage: add APBS-3.4.1 (from https://github.com/Electrostatics/apbs/releases/tag/v3.4.1) - requires to be placed in a directory called 'softwares' at the same level of Dockerfile
#################
FROM base_os_with_r_lib as base_os_with_apbs

# go to home surfmap
WORKDIR /surfmap

# copy APBS in /surfmap
COPY softwares/APBS-3.4.1.Linux APBS/

# set env vars for APBS
ENV APBS=/surfmap/APBS
ENV LD_LIBRARY_PATH=$APBS/lib
ENV PATH=$APBS/bin:$PATH

# 6th build stage: add surfmap package
#################
FROM base_os_with_apbs as surfmap_package

WORKDIR /surfmap

# install virtualenv, create one and add its bin directory into PATH
RUN pip install virtualenv && \
    virtualenv -p python3.10 .env

ENV PATH=/surfmap/.env/bin:$PATH

# add surfmap packages and setup.py
COPY ./ ./

# # install ORFmine python libraries & dependencies 
RUN pip install -e .

# create surfmap group and user (from https://github.com/dnaprawa/dockerfile-best-practices#run-as-a-non-root-user)
RUN adduser surfmap

# go to home surfmap
WORKDIR /home/surfmap

# run container as surfmap user and add input & output dirs
USER surfmap
RUN mkdir input output

Bests