Blame view

docker/Dockerfile 6.99 KB
564a4812   Etienne Pallier   added pylon6.3.0 ...
1
# https://pythonspeed.com/articles/base-image-python-docker-images
8124063f   Alexis Koralewski   Update dockerfile...
2
3
#FROM ubuntu:20.04
FROM ubuntu:22.04
d7a4c851   Etienne Pallier   Dockerfile avec U...
4
5
6
#FROM ubuntu:latest
#FROM ubuntu:21.10 # with python3.9
#FROM ubuntu:18.04
6cd48351   Etienne Pallier   AgentScheduler is...
7
8
# Pour eviter le warning : debconf: delaying package configuration, since apt-utils is not installed
ARG DEBIAN_FRONTEND=noninteractive
d7a4c851   Etienne Pallier   Dockerfile avec U...
9

564a4812   Etienne Pallier   added pylon6.3.0 ...
10
11
12
13
# Which glibc version ?
# ./SHELL
# $ ldd --version
# => ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31
83cfb55c   Etienne Pallier   sphinx autodoc ge...
14

d7a4c851   Etienne Pallier   Dockerfile avec U...
15
16
17
18
19
20
21
22
# Which Ubuntu version ?
# ./SHELL
# $ lsb_release -a
# => Distributor ID:	Ubuntu
# => Description:	Ubuntu 20.04.4 LTS
# => Release:	20.04
# => Codename:	focal

e4c37a1a   Alexis Koralewski   Upgrading mysql v...
23
ARG uid
5357999a   Alexis Koralewski   add Dockerfile
24

d7a4c851   Etienne Pallier   Dockerfile avec U...
25

f11ebe06   Etienne Pallier   Dockerfile cleanu...
26
27
28
29
30

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

d7a4c851   Etienne Pallier   Dockerfile avec U...
31
RUN apt-get update && apt-get upgrade -y
35a2d21d   Etienne Pallier   ajout commentaire...
32

d7a4c851   Etienne Pallier   Dockerfile avec U...
33
34
35
36
37
38
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata

RUN apt-get install -y \
	#mysql-server \
    mysql-client \
    #default-mysql-client \
c1067e64   Etienne Pallier   Changement OS pou...
39
	libmysqlclient-dev \
564a4812   Etienne Pallier   added pylon6.3.0 ...
40
    nano vim \
8124063f   Alexis Koralewski   Update dockerfile...
41
42
    git \
	curl
83cfb55c   Etienne Pallier   sphinx autodoc ge...
43

f11ebe06   Etienne Pallier   Dockerfile cleanu...
44
45
46
47
48


################
# Python & pip #
################
35a2d21d   Etienne Pallier   ajout commentaire...
49

8124063f   Alexis Koralewski   Update dockerfile...
50
51
# For apt-add-repository :
RUN apt-get install -y software-properties-common
8124063f   Alexis Koralewski   Update dockerfile...
52
53
# Needed for INDI
RUN apt-add-repository ppa:mutlaqja/ppa
35a2d21d   Etienne Pallier   ajout commentaire...
54
55
56
57

# PYTHON
# Needed for python 3.10
RUN apt-add-repository ppa:deadsnakes/ppa
8124063f   Alexis Koralewski   Update dockerfile...
58
59
60
61
62
63
64
65
66
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
d7a4c851   Etienne Pallier   Dockerfile avec U...
67
RUN cd /usr/bin && ln -s python3 python
8124063f   Alexis Koralewski   Update dockerfile...
68
69
70
#RUN apt-get install -y python3-pip
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
#RUN pip3 install --upgrade pip
e7016f79   Etienne Pallier   cleanup Dockerfil...
71
RUN python3 -m pip install --upgrade pip
8124063f   Alexis Koralewski   Update dockerfile...
72

ee31d41e   Alexis Koralewski   Remove gsc from D...
73

c1067e64   Etienne Pallier   Changement OS pou...
74

c1067e64   Etienne Pallier   Changement OS pou...
75

83cfb55c   Etienne Pallier   sphinx autodoc ge...
76
# DEV only
776d0b6c   Etienne Pallier   pyros v0.4
77
# for dot => PNG diagrams generation with pyreverse (pylint)
776d0b6c   Etienne Pallier   pyros v0.4
78
RUN apt-get install -y graphviz graphviz-dev
b183b691   akoralewski   add git on pyros ...
79

f11ebe06   Etienne Pallier   Dockerfile cleanu...
80
81
82
83
84
85
86
87
88
89
90


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

#
# Guitastro C/C++ dependencies
#

# - ASTROMETRY.NET (in order to process images locally, without having to send (big) images to astrometry.net)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
91
RUN apt-get install -y \
c1067e64   Etienne Pallier   Changement OS pou...
92
	astrometry.net astrometry-data-tycho2 \
564a4812   Etienne Pallier   added pylon6.3.0 ...
93
	#astrometry-data-2mass \
83cfb55c   Etienne Pallier   sphinx autodoc ge...
94
	# - PIL
564a4812   Etienne Pallier   added pylon6.3.0 ...
95
	python3-tk \
c1067e64   Etienne Pallier   Changement OS pou...
96
	python3-pil python3-pil.imagetk
83cfb55c   Etienne Pallier   sphinx autodoc ge...
97

f11ebe06   Etienne Pallier   Dockerfile cleanu...
98
# - INDI
79db9a00   Etienne Pallier   updated Dockerfil...
99
# https://indilib.org/get-indi/download-ubuntu.html
776d0b6c   Etienne Pallier   pyros v0.4
100
# Add repository
8124063f   Alexis Koralewski   Update dockerfile...
101

776d0b6c   Etienne Pallier   pyros v0.4
102
# Add public key for this repo
79db9a00   Etienne Pallier   updated Dockerfil...
103
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 487CEC2B3F33A288
776d0b6c   Etienne Pallier   pyros v0.4
104
#RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 487CEC2B3F33A288
79db9a00   Etienne Pallier   updated Dockerfil...
105
106
107
#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
83cfb55c   Etienne Pallier   sphinx autodoc ge...
108
#10 1.751 E: The repository 'http://ppa.launchpad.net/mutlaqja/ppa/ubuntu jammy InRelease' is not signed.
79db9a00   Etienne Pallier   updated Dockerfil...
109
RUN apt-get update 
c1067e64   Etienne Pallier   Changement OS pou...
110
RUN apt-get install -y indi-full
ee31d41e   Alexis Koralewski   Remove gsc from D...
111
RUN apt-get install -y kstars-bleeding libindi1 indi-bin swig libz3-dev libcfitsio-dev libnova-dev libindi-dev
83cfb55c   Etienne Pallier   sphinx autodoc ge...
112
113
114
# Obligatoire ?
#RUN pip install --user --install-option="--prefix=" pyindi-client

f11ebe06   Etienne Pallier   Dockerfile cleanu...
115
# - ASTAP (Astrometry)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
116
117
118
119
120
121
# 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

5137b9c9   Alexis Koralewski   Removing Pylon (B...
122
# - PYLON (Cameras BASLER) Not useful anymore
83cfb55c   Etienne Pallier   sphinx autodoc ge...
123
# https://www.baslerweb.com/en/products/software/basler-pylon-camera-software-suite/
c1067e64   Etienne Pallier   Changement OS pou...
124
# (you will have to fill a form to be able to download)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
125
126
127
128
129
# 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
5137b9c9   Alexis Koralewski   Removing Pylon (B...
130
131
# COPY ./install/guitastro/pylon_6.3.0.23157-deb0_amd64.deb .
# RUN apt-get install ./pylon_6.3.0.23157-deb0_amd64.deb
83cfb55c   Etienne Pallier   sphinx autodoc ge...
132

d7a4c851   Etienne Pallier   Dockerfile avec U...
133
134
RUN apt-get update && apt-get upgrade -y

83cfb55c   Etienne Pallier   sphinx autodoc ge...
135
136
137
138
139
140
141
142
143
144
145
# 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

f11ebe06   Etienne Pallier   Dockerfile cleanu...
146
# - Graphic layer
d7a4c851   Etienne Pallier   Dockerfile avec U...
147
148
149
150
# 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
c1067e64   Etienne Pallier   Changement OS pou...
151
152
#RUN apt-get install -y firefox x11vnc xvfb
#RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
d7a4c851   Etienne Pallier   Dockerfile avec U...
153
CMD ["x11vnc", "-create", "-forever"]
c1067e64   Etienne Pallier   Changement OS pou...
154
#RUN x11vnc -create -forever
83cfb55c   Etienne Pallier   sphinx autodoc ge...
155
156


f11ebe06   Etienne Pallier   Dockerfile cleanu...
157

b183b691   akoralewski   add git on pyros ...
158
159
160
# 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

e7016f79   Etienne Pallier   cleanup Dockerfil...
161
162


f11ebe06   Etienne Pallier   Dockerfile cleanu...
163
164
165
166
#################################
# PyROS user (better than root) #
#################################

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
167
# Adding new user (pyros_user) and creating his home folder
5a8b41da   Alexis Koralewski   update dockerfile...
168
RUN useradd -m -s /bin/bash pyros_user --uid $uid
5357999a   Alexis Koralewski   add Dockerfile
169
170
171

# 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
b6c8cde0   Alain Klotz   /pyros erased.
172
WORKDIR /home/pyros_user/app
5357999a   Alexis Koralewski   add Dockerfile
173

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
174
# Switch from root to pyros_user
5357999a   Alexis Koralewski   add Dockerfile
175
176
USER pyros_user

c1067e64   Etienne Pallier   Changement OS pou...
177
#RUN pip install --user wheel
83cfb55c   Etienne Pallier   sphinx autodoc ge...
178
# TODO: pourquoi numpy ??? A virer ?
c1067e64   Etienne Pallier   Changement OS pou...
179
#RUN pip install --user numpy
83cfb55c   Etienne Pallier   sphinx autodoc ge...
180

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
181
# Copy local host machine files to image
5a8b41da   Alexis Koralewski   update dockerfile...
182
COPY --chown=pyros_user:pyros_user . .
dc729fe1   Etienne Pallier   Sphinx autodoc ge...
183
184
185
# Copy some aliases
RUN cp .bash_aliases ..
#RUN mv .bash_aliases ..
f11ebe06   Etienne Pallier   Dockerfile cleanu...
186

699871e9   Alexis Koralewski   adding bin to pat...
187

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
188
# Adding local/bin to path to avoid pip warning
699871e9   Alexis Koralewski   adding bin to pat...
189
190
ENV PATH "$PATH:/home/pyros_user/.local/bin"

e7016f79   Etienne Pallier   cleanup Dockerfil...
191

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
192
# Installing click on the image to prevent error on the first execution of the installation script
e7016f79   Etienne Pallier   cleanup Dockerfil...
193
194
195
196
RUN python3 -m pip  install --user click

RUN python3 -m pip  install --user setuptools==58

540fa833   Etienne Pallier   New requirements....
197
198
199
200
201
202
203
# (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
e7016f79   Etienne Pallier   cleanup Dockerfil...
204
RUN python3 -m pip  install --user pip-tools
540fa833   Etienne Pallier   New requirements....
205

17c6eca0   Alexis Koralewski   Adding git clone ...
206
# Installing packages required for Guitastro
35a2d21d   Etienne Pallier   ajout commentaire...
207
RUN pip-compile ./vendor/guitastro/install/requirements.in 
e7016f79   Etienne Pallier   cleanup Dockerfil...
208
RUN python3 -m pip  install --user -r ./vendor/guitastro/install/requirements.txt
3474fbe0   Etienne Pallier   added commentaires
209
210
# Maybe unnecessary because same requirements as for pyros requirements_dev (?)
#RUN pip install --user -r ./vendor/guitastro/install/requirements_dev.txt
f11ebe06   Etienne Pallier   Dockerfile cleanu...
211

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
212
# Installing packages required for PyROS
e7016f79   Etienne Pallier   cleanup Dockerfil...
213
214
RUN python3 -m pip  install --user -r ./install/requirements.txt
RUN python3 -m pip  install --user -r ./install/requirements_dev.txt