Commit 00f271d6 authored by karpov-sv's avatar karpov-sv
Browse files

Simplify the Docker image building, and make it run Jupyter notebook as an entry point

parent f187e0dc
......@@ -27,6 +27,6 @@ jobs:
run: |
docker build -t stdpipe/stdpipe . && docker push stdpipe/stdpipe
- name: Start containers
run: |
docker-compose up -d
# - name: Start containers
# run: |
# docker-compose up -d
ARG SCAMP_version=v2.6.7
ARG SWARP_version=2.38.0
ARG Sextractor_version=2.25.0
ARG PSFEX_version=3.21.1
# Building image from
# Building image from
FROM ubuntu:20.04
LABEL maintainer="Michael Coughlin <cough052@umn.edu>"
LABEL maintainer="Sergey Karpov <karpov.sv@gmail.com>"
# Create a variable corresponding to the name of the new user that will be created inside the Docker.
ENV USR newuser
ENV USERNAME newuser
# Create new user
RUN useradd -ms /bin/bash ${USERNAME}
# Set up working directory
# Set the working directory
WORKDIR /home
# Create new user
RUN useradd -ms /bin/bash ${USR}
# Fix for tzdata which is pulled by some dependencies
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Prague
ARG SCAMP_version
ARG SWARP_version
ARG Sextractor_version
ARG PSFEX_version
# Install updates to base image, install packages, and remove from cache
# Create astromatic folder, and install all needed astromatic software and hotpants
# First download and build cfitsio and the cdsclient used by SCAMP
# Install all python packages. numpy 1.19.0 is the latest dependency compatible with tensorflow 2.3.1
# Install hotpants
# Install Jupyter
# Install some Python packages
# All done in one line to limit docker size
RUN \
apt-get update \
&& apt-get install software-properties-common -y \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt-get update \
&& apt-get install -y --no-install-recommends wget curl vim build-essential ca-certificates libtool libatlas3-base libatlas-base-dev libplplot-dev libfftw3-dev libcurl4-openssl-dev autoconf automake git unzip gfortran python3.9 python3.9-dev python3-pip \
&& apt-get install -y --no-install-recommends libcfitsio-dev sextractor scamp psfex swarp \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/acbecker/hotpants.git \
&& cd hotpants \
&& make \
&& cp hotpants /usr/local/bin/ \
&& cd .. \
&& rm -fr astromatic hotpants cfitsio-* cdsclient-* \
&& python3.9 -m pip install --upgrade pip \
&& python3.9 -m pip install setuptools cmake \
&& python3.9 -m pip install scikit-build \
&& python3.9 -m pip install numpy scipy matplotlib astropy pandas shapely requests h5py scikit-image lacosmic hjson voevent-parse xmltodict astroML photutils keras keras-vis cython regions opencv-python-headless astroscrappy astroquery tqdm
RUN \
git clone https://github.com/karpov-sv/stdpipe.git \
&& cd stdpipe \
&& python3.9 setup.py install \
&& rm -fr /home/newuser/.cache/pip \
&& rm -fr /root/.cache/pip \
&& rm -fr /root/.cache/* \
&& rm -fr /tmp/* \
&& apt-get autoremove --purge -y
#&& apt-get purge -y gfortran gfortran-7 git-man libgfortran-7-dev libgfortran4
apt-get update \
&& apt-get install -y --no-install-recommends build-essential ca-certificates libtool libcfitsio-dev autoconf automake git unzip python3-pip \
sextractor scamp psfex swarp \
jupyter jupyter-notebook jupyter-nbextension-jupyter-js-widgets python3-ipywidgets \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/acbecker/hotpants.git \
&& cd hotpants \
&& make \
&& cp hotpants /usr/local/bin/ \
&& cd .. \
&& rm -fr hotpants \
&& python3 -m pip install --upgrade pip \
&& python3 -m pip install setuptools
# Install STDPipe
RUN \
git clone https://github.com/karpov-sv/stdpipe.git \
&& cd stdpipe \
&& python3 -m pip install -e . \
&& rm -fr /home/newuser/.cache/pip \
&& rm -fr /root/.cache/pip \
&& rm -fr /root/.cache/* \
&& rm -fr /tmp/* \
&& apt-get autoremove --purge -y
# switch ownership
# (all commands are root until a USER command changes that)
USER ${USR}
# Set the working directory
WORKDIR /home/${USR}
USER ${USERNAME}
# change ownership from root to USR:
# Create directory to link on volume with host machine
RUN chown -R ${USR}:${USR} /home/${USR} \
&& mkdir /home/${USR}/stdpipe/
# Create `stdpipe` directory to link on volume with host machine
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME} \
&& mkdir /home/${USERNAME}/stdpipe/
# Add local bin to PATH
ENV PATH="/home/${USR}/.local/bin:$PATH"
ENV PATH="/home/${USERNAME}/.local/bin:$PATH"
# Change working directory to stdpipe
WORKDIR /home/${USR}/stdpipe
WORKDIR /home/${USERNAME}/stdpipe
# define entrypoint which is the default executable at launch
ENTRYPOINT ["bash"]
ENTRYPOINT ["jupyter", "notebook", "--no-browser", "--ip=0.0.0.0", "--NotebookApp.token=''"]
EXPOSE 8888
......@@ -4,5 +4,4 @@ services:
stdpipe:
image: stdpipe/stdpipe
ports:
- "9000:5000"
- "9001:5001"
- "9000:8888"
......@@ -6,12 +6,10 @@ from setuptools import setup, find_packages
__version__ = '0.1'
requirements = [
'configargparse',
'numpy',
'scipy',
'astropy>=4.1',
'matplotlib',
'pandas',
'astroquery>0.4.1',
'sep',
'photutils',
......@@ -28,14 +26,14 @@ setup(
description='Simple Transient Detection Pipeline',
author='Sergey Karpov',
author_email='karpov.sv@gmail.com',
url='',
url='https://github.com/karpov-sv/stdpipe',
install_requires=requirements,
packages=['stdpipe'],
package_data={'stdpipe':['data/*']},
include_package_data=True,
extras_require={
"example": [
'astroscrappy',
],
"example": [
'astroscrappy',
],
},
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment