Commit d7a4c8512840d46103c17eee4de3af340bb0aada

Authored by Etienne Pallier
1 parent 564a4812
Exists in dev

Dockerfile avec Ubuntu20.04, Python3.8 et VNC server

Showing 3 changed files with 38 additions and 16 deletions   Show diff stats
Dockerfile
1 1 # https://pythonspeed.com/articles/base-image-python-docker-images
2 2 FROM ubuntu:20.04
  3 +#FROM ubuntu:latest
  4 +#FROM ubuntu:21.10 # with python3.9
  5 +#FROM ubuntu:18.04
  6 +
3 7 # Which glibc version ?
4 8 # ./SHELL
5 9 # $ ldd --version
6 10 # => ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31
7 11  
  12 +# Which Ubuntu version ?
  13 +# ./SHELL
  14 +# $ lsb_release -a
  15 +# => Distributor ID: Ubuntu
  16 +# => Description: Ubuntu 20.04.4 LTS
  17 +# => Release: 20.04
  18 +# => Codename: focal
  19 +
8 20 ARG uid
9 21  
10   -RUN apt-get update && apt-get install -y \
11   - default-mysql-client \
  22 +
  23 +RUN apt-get update && apt-get upgrade -y
  24 +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
  25 +
  26 +RUN apt-get install -y \
  27 + #mysql-server \
  28 + mysql-client \
  29 + #default-mysql-client \
12 30 libmysqlclient-dev \
13 31 nano vim \
14 32 git
15 33  
16 34 # Python3.8 & pip
17 35 RUN apt-get install -y python3.8
  36 +RUN apt-get install -y python3.8-dev
18 37 RUN apt-get install -y python3-pip
  38 +RUN cd /usr/bin && ln -s python3 python
  39 +RUN python -m pip install --upgrade pip
19 40  
20 41 # For guitastro
21 42  
22 43 # DEV only
23 44 # for dot => PNG diagrams generation with pyreverse (pylint)
24   -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
25 45 RUN apt-get install -y graphviz graphviz-dev
26 46  
27 47 # Guitastro
... ... @@ -48,15 +68,7 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 487CEC2B3F
48 68 #10 1.751 E: The repository 'http://ppa.launchpad.net/mutlaqja/ppa/ubuntu jammy InRelease' is not signed.
49 69 RUN apt-get update
50 70 RUN apt-get install -y indi-full
51   -RUN apt-get install -y gsc
52   -RUN apt-get install -y kstars-bleeding
53   -RUN apt-get install -y libindi1
54   -RUN apt-get install -y indi-bin
55   -RUN apt-get install -y swig
56   -RUN apt-get install -y libz3-dev
57   -RUN apt-get install -y libcfitsio-dev
58   -RUN apt-get install -y libnova-dev
59   -RUN apt-get install -y libindi-dev
  71 +RUN apt-get install -y gsc kstars-bleeding libindi1 indi-bin swig libz3-dev libcfitsio-dev libnova-dev libindi-dev
60 72 # Obligatoire ?
61 73 #RUN pip install --user --install-option="--prefix=" pyindi-client
62 74  
... ... @@ -78,6 +90,8 @@ RUN rm ./astap_amd64.deb
78 90 COPY ./install/guitastro/pylon_6.3.0.23157-deb0_amd64.deb .
79 91 RUN apt-get install ./pylon_6.3.0.23157-deb0_amd64.deb
80 92  
  93 +RUN apt-get update && apt-get upgrade -y
  94 +
81 95 # Guitastro DEV only
82 96  
83 97 # - ANACONDA / SPYDER
... ... @@ -89,9 +103,13 @@ RUN apt-get install ./pylon_6.3.0.23157-deb0_amd64.deb
89 103 # apt install spyder
90 104 # apt install graphviz libgraphviz-dev
91 105  
  106 +# Add a VNC server to have local graphic windows
  107 +# When you run this container, a VNC server will be created automatically.
  108 +# You must bind a host port to the container’s port 5900 – this is the port the VNC server will be exposed on
  109 +RUN apt-get install -y x11vnc xvfb
92 110 #RUN apt-get install -y firefox x11vnc xvfb
93 111 #RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
94   -#CMD ["x11vnc", "-create", "-forever"]
  112 +CMD ["x11vnc", "-create", "-forever"]
95 113 #RUN x11vnc -create -forever
96 114  
97 115  
... ... @@ -109,7 +127,8 @@ WORKDIR /home/pyros_user/app
109 127 # Switch from root to pyros_user
110 128 USER pyros_user
111 129  
112   -RUN pip install --user --upgrade pip
  130 +#RUN python -m pip3 install --user --upgrade pip
  131 +#RUN pip install --user --upgrade pip
113 132 #RUN pip install --user wheel
114 133 # TODO: pourquoi numpy ??? A virer ?
115 134 #RUN pip install --user numpy
... ...
docker/docker-compose.yml
... ... @@ -11,6 +11,7 @@ services:
11 11 environment:
12 12 # note : as db is an image of mysql, this root password will be set on the first installation on the image, if the value is changed, it will not be updated in the database
13 13 - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}"
  14 + - VNC_NO_PASSWORD=1
14 15 volumes:
15 16 - db:/var/lib/mysql/
16 17 # create network to allow images to communicate with other images within the same network
... ... @@ -41,6 +42,7 @@ services:
41 42 args:
42 43 uid: ${CURRENT_UID}
43 44 context: ..
  45 + #filename: Dockerfile
44 46 container_name: pyros
45 47 # tty is the -t option in docker exec
46 48 tty: true
... ... @@ -51,6 +53,7 @@ services:
51 53 # tells which port of local machine can communicate with the docker image (host:container), host is your local machine
52 54 ports:
53 55 - "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}"
  56 + - 5900:5900
54 57 # starting db service before install service
55 58 depends_on:
56 59 - db
... ... @@ -68,4 +71,4 @@ volumes:
68 71 networks:
69 72 pyros-network:
70 73 #bridge is the default network driver
71   - driver: bridge
72 74 \ No newline at end of file
  75 + driver: bridge
... ...
pyros.py
... ... @@ -594,7 +594,7 @@ def install_or_update(UPDATE: bool = False, with_packages: bool = True, with_dat
594 594 os.system(VENV_PYTHON + ' -m pip install --user --upgrade pip')
595 595 #TODO: faire les apt-get intall aussi (indi, ...)
596 596 venv_pip_install2(GUITASTRO_PATH + '/install/requirements.txt', '-r')
597   - venv_pip_install2(GUITASTRO_PATH + '/install/requirements_linux.txt', '-r')
  597 + #venv_pip_install2(GUITASTRO_PATH + '/install/requirements_linux.txt', '-r')
598 598 venv_pip_install2(GUITASTRO_PATH + '/install/requirements_dev.txt', '-r')
599 599 '''
600 600 print("Guitastro : Generating (updating) API documentation (using Sphinx)")
... ...