Skip to content

Commit

Permalink
updated dockerfile and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 20, 2024
1 parent 47ad03d commit e2da240
Show file tree
Hide file tree
Showing 10 changed files with 1,711 additions and 1,859 deletions.
102 changes: 63 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,73 @@
# FROM ubuntu:latest
# # FROM ghcr.io/biosimulators/biosimulators:latest
#
# WORKDIR /app
#
# COPY . /app
#
# RUN apt-get update && apt-get install -y \
# build-essential \
# cmake \
# gcc \
# && rm -rf /var/lib/apt/lists/*
#
# RUN pip install --upgrade pip \
# && pip install poetry
#
# RUN poetry run pip install --upgrade pip \
# && poetry run pip install smoldyn \
# && poetry install
# # && pip install .

# Start with the latest Ubuntu base image
FROM ubuntu:latest

RUN echo "Installing singularity..."
RUN apt-get update -y && apt-get install -y \
build-essential \
libseccomp-dev \
pkg-config \
squashfs-tools
# cryptsetup

ENV GO_VERSION "1.20"
ENV SINGULARITY_VERSION "3.9.5"
ENV OS "linux"
ENV ARCH "amd64"

RUN echo "Installing Go..." \
RUN wget https://dl.google.com/go/go$GO_VERSION.$OS-$ARCH.tar.gz \
&& tar -C /usr/local -xzvf go$GO_VERSION.$OS-$ARCH.tar.gz \
&& rm go$GO_VERSION.$OS-$ARCH.tar.gz \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> ~/.bashrc \
&& source ~/.bashrc \
&& echo "/usr/local/go/bin" >> $GITHUB_PATH \
&& echo "Installing Singularity..." \
&& wget https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz \
&& tar -xzf singularity-ce-${SINGULARITY_VERSION}.tar.gz \
&& cd singularity-ce-${SINGULARITY_VERSION} \
&& ./mconfig \
&& make -C builddir \
&& make -C builddir install

RUN echo "Installing python system dependencies..."
RUN apt-get update && apt-get install -y \
python3 \
python3-pip
ENV DEBIAN_FRONTEND=noninteractive

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

RUN echo "Installing python content..."
RUN pip install --upgrade pip \
&& pip install -U "ray[default]" \
&& ./scripts/install-smoldyn-mac-silicon.sh
# Install Python 3.9, pip, Python development package, and other dependencies
RUN apt-get update && apt-get install -y \
# software-properties-common \
# && add-apt-repository -y ppa:deadsnakes/ppa \
# && apt-get update \
# && apt-get install -y \
# python3.9 \
# python3.9-distutils \
# python3.9-venv \
# python3.9-dev \
python3 \
python3-pip \
build-essential \
libncurses5 \
cmake \
gcc \
swig \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# Update alternatives to use Python 3.9
# RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 \
# && update-alternatives --set python3 /usr/bin/python3.9

# Install pip for Python 3.9
RUN apt-get update && apt-get install -y python3-pip

# Install Poetry
RUN python3 -m pip install poetry

# Avoid creating virtual environments as Docker provides isolation
RUN poetry config virtualenvs.create false

RUN poetry run pip install smoldyn

RUN echo "Entering..."
ENTRYPOINT ["/bin/bash"]
# Install project dependencies using Poetry
RUN poetry install

ENV DEBIAN_FRONTEND=interactive

# ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
ENTRYPOINT ["poetry", "run", "jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
6 changes: 6 additions & 0 deletions Dockerfile-assets/.pys_usercfg.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Pysces]
model_dir = /Pysces/psc
output_dir = /Pysces
change_dir_on_start = False
silentstart = True
matplotlib_backend = native
15 changes: 15 additions & 0 deletions Dockerfile-assets/xvfb-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
displayLogFilename=$(mktemp /tmp/display.XXXXXX.log)
exec 6>${displayLogFilename}
set -e
Xvfb -displayfd 6 -ac -screen 0 "$XVFB_RES" -nolisten tcp $XVFB_ARGS &
XVFB_PROC=$!
sleep 1
export DISPLAY=":`cat ${displayLogFilename}`"
set +e
"$@"
result=$?
kill $XVFB_PROC || true
exec 6>&-
rm ${displayLogFilename}
exit $result
36 changes: 36 additions & 0 deletions __Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use the latest Ubuntu image as the base
FROM ubuntu:latest

WORKDIR /app

COPY . /app

RUN apt-get update && apt-get install -y \
python3.9 \
python3-pip \
build-essential \
cmake \
gcc \
&& rm -rf /var/lib/apt/lists/*

###################################
# setup headless for NEURON, Smoldyn
# RUN apt-get -y update \
# \
# && apt-get install --no-install-recommends -y \
# xvfb \
# && mkdir /tmp/.X11-unix \
# && chmod 1777 /tmp/.X11-unix \
# \
# && rm -rf /var/lib/apt/lists/*
#
# ENV XVFB_RES="1920x1080x24" \
# XVFB_ARGS=""

RUN pip3 install poetry

RUN poetry run pip install --upgrade pip \
&& poetry run pip install smoldyn \
&& poetry install # --no-dev

ENTRYPOINT ["poetry", "run", "jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
7 changes: 7 additions & 0 deletions pip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

pkg="$1"

pip install "${pkg}"
pip show "${pkg}"

Loading

0 comments on commit e2da240

Please sign in to comment.