Dockerfile 7 KB
# https://pythonspeed.com/articles/base-image-python-docker-images
#FROM ubuntu:20.04
FROM ubuntu:22.04
#FROM ubuntu:latest
#FROM ubuntu:21.10 # with python3.9
#FROM ubuntu:18.04
# Pour eviter le warning : debconf: delaying package configuration, since apt-utils is not installed
ARG DEBIAN_FRONTEND=noninteractive

# Which glibc version ?
# ./SHELL
# $ ldd --version
# => ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31

# Which Ubuntu version ?
# ./SHELL
# $ lsb_release -a
# => Distributor ID:	Ubuntu
# => Description:	Ubuntu 20.04.4 LTS
# => Release:	20.04
# => Codename:	focal

ARG uid



################
# Mysql client #
################

RUN apt-get update && apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata

RUN apt-get install -y \
	#mysql-server \
    mysql-client \
    #default-mysql-client \
	libmysqlclient-dev \
    nano vim \
    git \
	curl



################
# Python & pip #
################
# For apt-add-repository :
RUN apt-get install -y software-properties-common
# Needed for python 3.10
RUN add-apt-repository ppa:deadsnakes/ppa
# Needed for INDI
RUN apt-add-repository ppa:mutlaqja/ppa
RUN apt-get install -y python3.10
RUN apt-get install -y python3.10-dev
RUN apt-get install -y python3.10-distutils
#RUN ln -sf /usr/bin/python3.10 /usr/bin/python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
#RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
RUN ln -sf /usr/bin/python3.10 /usr/bin/python3
RUN update-alternatives --config python3
RUN apt-get install -y python3-apt
RUN cd /usr/bin && ln -s python3 python
#RUN apt-get install -y python3-pip
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
#RUN pip3 install --upgrade pip
RUN python3.10 -m pip install --upgrade pip




# DEV only
# for dot => PNG diagrams generation with pyreverse (pylint)
RUN apt-get install -y graphviz graphviz-dev



#############
# GUITASTRO #
#############

#
# Guitastro C/C++ dependencies
#

# - ASTROMETRY.NET (in order to process images locally, without having to send (big) images to astrometry.net)
RUN apt-get install -y \
	astrometry.net astrometry-data-tycho2 \
	#astrometry-data-2mass \
	# - PIL
	python3-tk \
	python3-pil python3-pil.imagetk

# - INDI
# https://indilib.org/get-indi/download-ubuntu.html
# Add repository

# Add public key for this repo
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 487CEC2B3F33A288
#RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 487CEC2B3F33A288
#RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 487CEC2B3F33A288
#RUN apt-key adv --keyserver http://ppa.launchpad.net/mutlaqja/ppa/ubuntu/dists/jammy --recv-keys 487CEC2B3F33A288
#RUN apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 487CEC2B3F33A288
#10 1.751 E: The repository 'http://ppa.launchpad.net/mutlaqja/ppa/ubuntu jammy InRelease' is not signed.
RUN apt-get update 
RUN apt-get install -y indi-full
RUN apt-get install -y kstars-bleeding libindi1 indi-bin swig libz3-dev libcfitsio-dev libnova-dev libindi-dev
# Obligatoire ?
#RUN pip install --user --install-option="--prefix=" pyindi-client

# - ASTAP (Astrometry)
# Download .deb file from https://www.hnsky.org/astap.htm
RUN apt-get install -y wget 
RUN wget https://www.hnsky.org/astap_amd64.deb
RUN apt-get install -y ./astap_amd64.deb
RUN rm ./astap_amd64.deb

# - PYLON (Cameras BASLER) Not useful anymore
# https://www.baslerweb.com/en/products/software/basler-pylon-camera-software-suite/
# (you will have to fill a form to be able to download)
# pylon_6.3.0.23157_x86_64_setup.tar.gz
# tar -xvf pylon_6.3.0.23157_x86_64_setup.tar.gz
# copier le fichier pylon_6.3.0.23157_x86_64.tar.gz à l’endroit où installer le logiciel.
# tar -xvf pylon_6.3.0.23157_x86_64.tar.gz
# apt-get install ./pylon_6.3.0.23157-deb0_amd64.deb
# COPY ./install/guitastro/pylon_6.3.0.23157-deb0_amd64.deb .
# RUN apt-get install ./pylon_6.3.0.23157-deb0_amd64.deb

RUN apt-get update && apt-get upgrade -y

# Guitastro DEV only

# - ANACONDA / SPYDER
# https://www.anaconda.com/products/individual
# Install spyder

# - DOCUMENT GENERATION
# apt-get install python3-sphinx
# apt install spyder
# apt install graphviz libgraphviz-dev

# - Graphic layer
# Add a VNC server to have local graphic windows
# When you run this container, a VNC server will be created automatically. 
# You must bind a host port to the container’s port 5900 – this is the port the VNC server will be exposed on
RUN apt-get install -y x11vnc xvfb
#RUN apt-get install -y firefox x11vnc xvfb
#RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
CMD ["x11vnc", "-create", "-forever"]
#RUN x11vnc -create -forever





# Get IRAP self signed certificate
RUN echo | openssl s_client -connect gitlab.irap.omp.eu:443 -servername gitlab.irap.omp.eu 2>/dev/null | openssl x509 > /etc/ssl/certs/gitlab.irap.omp.eu.crt

#################################
# PyROS user (better than root) #
#################################

# Adding new user (pyros_user) and creating his home folder
RUN useradd -m -s /bin/bash pyros_user --uid $uid

# Create the work dir and set permissions as pyros_user 
RUN mkdir -p /home/pyros_user/app/ && chown -R pyros_user:pyros_user /home/pyros_user/app
WORKDIR /home/pyros_user/app

# Switch from root to pyros_user
USER pyros_user

#RUN pip install --user wheel
# TODO: pourquoi numpy ??? A virer ?
#RUN pip install --user numpy



# Copy local host machine files to image
COPY --chown=pyros_user:pyros_user . .
# Copy some aliases
RUN cp .bash_aliases ..
#RUN mv .bash_aliases ..


# Adding local/bin to path to avoid pip warning
ENV PATH "$PATH:/home/pyros_user/.local/bin"

# Installing click on the image to prevent error on the first execution of the installation script
RUN python3.10 -m pip  install --user click
RUN python3.10 -m pip  install --user setuptools==58
# (EP 23/3/2022) Installing pip-tools for the management of all the requirements*.txt files (python dependencies packages)
# NB :
# - pip-tools generates a smarter and smaller requirements.txt file than the traditional "pip freeze"
# - pip-tools is also better than the traditional "pip install -r" for installing the python packages
# - Unfortunatly, it is difficult to use with several requirements*.txt files as it is the case for this software : pyros + sphinx + guitastro...
# - So we cannot yet use it completely and still have to use the traditional "pip install -r" anyway ...
# - But we can at least use it to generate all the requirements*.txt files in a far better format
RUN python3.10 -m pip  install --user pip-tools

RUN pip-compile ./vendor/guitastro/install/requirements.in 
# Installing packages required for Guitastro
RUN python3.10 -m pip  install --user -r ./vendor/guitastro/install/requirements.txt
# Maybe unnecessary because same requirements as for pyros requirements_dev (?)
#RUN pip install --user -r ./vendor/guitastro/install/requirements_dev.txt

# Installing packages required for PyROS
RUN python3.10 -m pip  install --user -r ./install/requirements.txt
RUN python3.10 -m pip  install --user -r ./install/requirements_dev.txt