Blame view

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

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

d7a4c851   Etienne Pallier   Dockerfile avec U...
14
15
16
17
18
19
20
21
# 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...
22
ARG uid
5357999a   Alexis Koralewski   add Dockerfile
23

d7a4c851   Etienne Pallier   Dockerfile avec U...
24

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

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

d7a4c851   Etienne Pallier   Dockerfile avec U...
30
31
32
33
34
35
36
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 \
c1067e64   Etienne Pallier   Changement OS pou...
37
	libmysqlclient-dev \
564a4812   Etienne Pallier   added pylon6.3.0 ...
38
39
    nano vim \
    git
83cfb55c   Etienne Pallier   sphinx autodoc ge...
40

f11ebe06   Etienne Pallier   Dockerfile cleanu...
41
42
43
44
45


################
# Python & pip #
################
c1067e64   Etienne Pallier   Changement OS pou...
46
RUN apt-get install -y python3.8
d7a4c851   Etienne Pallier   Dockerfile avec U...
47
RUN apt-get install -y python3.8-dev
c1067e64   Etienne Pallier   Changement OS pou...
48
RUN apt-get install -y python3-pip
d7a4c851   Etienne Pallier   Dockerfile avec U...
49
50
RUN cd /usr/bin && ln -s python3 python
RUN python -m pip install --upgrade pip
c1067e64   Etienne Pallier   Changement OS pou...
51

c1067e64   Etienne Pallier   Changement OS pou...
52

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

f11ebe06   Etienne Pallier   Dockerfile cleanu...
57
58
59
60
61
62
63
64
65
66
67


#############
# 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...
68
RUN apt-get install -y \
c1067e64   Etienne Pallier   Changement OS pou...
69
	astrometry.net astrometry-data-tycho2 \
564a4812   Etienne Pallier   added pylon6.3.0 ...
70
	#astrometry-data-2mass \
83cfb55c   Etienne Pallier   sphinx autodoc ge...
71
	# - PIL
564a4812   Etienne Pallier   added pylon6.3.0 ...
72
	python3-tk \
c1067e64   Etienne Pallier   Changement OS pou...
73
	python3-pil python3-pil.imagetk
83cfb55c   Etienne Pallier   sphinx autodoc ge...
74

f11ebe06   Etienne Pallier   Dockerfile cleanu...
75
# - INDI
79db9a00   Etienne Pallier   updated Dockerfil...
76
# https://indilib.org/get-indi/download-ubuntu.html
83cfb55c   Etienne Pallier   sphinx autodoc ge...
77
78
# For apt-add-repository :
RUN apt-get install -y software-properties-common
776d0b6c   Etienne Pallier   pyros v0.4
79
# Add repository
83cfb55c   Etienne Pallier   sphinx autodoc ge...
80
RUN apt-add-repository ppa:mutlaqja/ppa
776d0b6c   Etienne Pallier   pyros v0.4
81
# Add public key for this repo
79db9a00   Etienne Pallier   updated Dockerfil...
82
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 487CEC2B3F33A288
776d0b6c   Etienne Pallier   pyros v0.4
83
#RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 487CEC2B3F33A288
79db9a00   Etienne Pallier   updated Dockerfil...
84
85
86
#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...
87
#10 1.751 E: The repository 'http://ppa.launchpad.net/mutlaqja/ppa/ubuntu jammy InRelease' is not signed.
79db9a00   Etienne Pallier   updated Dockerfil...
88
RUN apt-get update 
c1067e64   Etienne Pallier   Changement OS pou...
89
RUN apt-get install -y indi-full
d7a4c851   Etienne Pallier   Dockerfile avec U...
90
RUN apt-get install -y gsc kstars-bleeding libindi1 indi-bin swig libz3-dev libcfitsio-dev libnova-dev libindi-dev
83cfb55c   Etienne Pallier   sphinx autodoc ge...
91
92
93
# Obligatoire ?
#RUN pip install --user --install-option="--prefix=" pyindi-client

f11ebe06   Etienne Pallier   Dockerfile cleanu...
94
# - ASTAP (Astrometry)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
95
96
97
98
99
100
# 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

f11ebe06   Etienne Pallier   Dockerfile cleanu...
101
# - PYLON (Cameras BASLER)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
102
# https://www.baslerweb.com/en/products/software/basler-pylon-camera-software-suite/
c1067e64   Etienne Pallier   Changement OS pou...
103
# (you will have to fill a form to be able to download)
83cfb55c   Etienne Pallier   sphinx autodoc ge...
104
105
106
107
108
# 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
c1067e64   Etienne Pallier   Changement OS pou...
109
110
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...
111

d7a4c851   Etienne Pallier   Dockerfile avec U...
112
113
RUN apt-get update && apt-get upgrade -y

83cfb55c   Etienne Pallier   sphinx autodoc ge...
114
115
116
117
118
119
120
121
122
123
124
# 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...
125
# - Graphic layer
d7a4c851   Etienne Pallier   Dockerfile avec U...
126
127
128
129
# 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...
130
131
#RUN apt-get install -y firefox x11vnc xvfb
#RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
d7a4c851   Etienne Pallier   Dockerfile avec U...
132
CMD ["x11vnc", "-create", "-forever"]
c1067e64   Etienne Pallier   Changement OS pou...
133
#RUN x11vnc -create -forever
83cfb55c   Etienne Pallier   sphinx autodoc ge...
134
135


f11ebe06   Etienne Pallier   Dockerfile cleanu...
136
137
138



b183b691   akoralewski   add git on pyros ...
139
140
141
# 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

f11ebe06   Etienne Pallier   Dockerfile cleanu...
142
143
144
145
#################################
# PyROS user (better than root) #
#################################

e4c37a1a   Alexis Koralewski   Upgrading mysql v...
146
RUN echo "$uid" > test.txt
dc729fe1   Etienne Pallier   Sphinx autodoc ge...
147
# Adding new user (pyros_user) and creating his home folder
e4c37a1a   Alexis Koralewski   Upgrading mysql v...
148
RUN useradd --create-home --shell /bin/bash pyros_user --uid $uid
5357999a   Alexis Koralewski   add Dockerfile
149
150
151
152
153

# 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

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
154
# Switch from root to pyros_user
5357999a   Alexis Koralewski   add Dockerfile
155
156
USER pyros_user

c1067e64   Etienne Pallier   Changement OS pou...
157
#RUN pip install --user wheel
83cfb55c   Etienne Pallier   sphinx autodoc ge...
158
# TODO: pourquoi numpy ??? A virer ?
c1067e64   Etienne Pallier   Changement OS pou...
159
#RUN pip install --user numpy
83cfb55c   Etienne Pallier   sphinx autodoc ge...
160

f11ebe06   Etienne Pallier   Dockerfile cleanu...
161
162


dc729fe1   Etienne Pallier   Sphinx autodoc ge...
163
# Copy local host machine files to image
699871e9   Alexis Koralewski   adding bin to pat...
164
COPY --chown=pyros_user:pyros_user . .
dc729fe1   Etienne Pallier   Sphinx autodoc ge...
165
166
167
# Copy some aliases
RUN cp .bash_aliases ..
#RUN mv .bash_aliases ..
f11ebe06   Etienne Pallier   Dockerfile cleanu...
168

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

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

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
173
# Installing click on the image to prevent error on the first execution of the installation script
699871e9   Alexis Koralewski   adding bin to pat...
174
175
RUN pip install --user click

540fa833   Etienne Pallier   New requirements....
176
177
178
179
180
181
182
183
184
# (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 pip install --user pip-tools

17c6eca0   Alexis Koralewski   Adding git clone ...
185
186
# Installing packages required for Guitastro
RUN pip install --user -r ./vendor/guitastro/install/requirements.txt
3474fbe0   Etienne Pallier   added commentaires
187
188
# 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...
189

dc729fe1   Etienne Pallier   Sphinx autodoc ge...
190
# Installing packages required for PyROS
12ddccd6   Etienne Pallier   sphinx doc auto g...
191
RUN pip install --user -r ./install/requirements.txt
2b4e74ac   Etienne Pallier   sphinx autodoc v5
192
RUN pip install --user -r ./install/requirements_dev.txt
f11ebe06   Etienne Pallier   Dockerfile cleanu...