Commit 3f16bc14 authored by GATEAU Thibault's avatar GATEAU Thibault
Browse files

[docker] adding docker images

parent 582eb9a7
# Program: Dockerfile (for NASA GMAT)
# Purpose: create a dockerfile container image for GMAT
# Author: Thibault Gateau
# License: AGPL-V3
# Remark:
# Additional package installation is based on NASA GMAT website documentation
#
#FROM debian:jessie
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
x11-apps \
&& rm -rf /usr/share/doc/* && \
rm -rf /usr/share/info/* && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*
#confort
RUN apt-get -y install locate
RUN updatedb
RUN apt-get -y install tree
#RUN apt-get install apt-file
#RUN apt-file update
#RUN apt update
# ldconfig -p | grep libGL.so.1
# set working directory
WORKDIR /app
COPY GMAT .
RUN pwd
RUN ls -al
RUN apt-get -y install dialog apt-utils
RUN apt-get -y install build-essential
RUN apt-get -y install zlib1g-dev
RUN cd libpng-1.2.54
RUN pwd
RUN ls -al
RUN ./libpng-1.2.54/autogen.sh
RUN ./libpng-1.2.54/configure
RUN make -j8
RUN make install
RUN apt-get -y install libgl1-mesa-glx
RUN apt-get -y install libopengl0
RUN apt-get -y install libglu1-mesa-dev
RUN apt-get -y install libgtk2.0-0
RUN useradd -ms /bin/bash user
USER user
#CMD xeyes
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
#./R2020a/bin/GMAT_Beta
#RUNNING DISPAY
#docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:gui bash
#xeyes
#RUNNING DEV
#docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -u root gmat:gui bash
#xeyes
#Error: Can't open display: :0
# Program: Dockerfile (for NASA GMAT)
# Purpose: create a dockerfile container image for GMAT
# Author: Thibault Gateau
# License: AGPL-V3
# Remark:
# Additional package installation is based on NASA GMAT website documentation
#
FROM ubuntu:18.04
# set working directory
WORKDIR /app
RUN pwd
RUN ls -al
RUN apt-get -y update
#RUN apt-get -y upgrade
RUN apt-get -y install apt-utils
#RUN apt-get -y install automake autoconf
RUN apt-get -y install libtool
#RUN apt-get -y install aclocal
#RUN apt-get install libpng 1.2.54-1ubuntu1.1
#RUN apt-get -y install libpng12-0
COPY GMAT .
RUN pwd
RUN ls -al
RUN apt-get -y install dialog apt-utils
RUN apt-get -y install build-essential
RUN apt-get -y install zlib1g-dev
RUN apt-get -y install libopengl0
#RUN apt-get -y install xserver-xorg-core
RUN cd libpng-1.2.54
RUN pwd
RUN ls -al
RUN ./libpng-1.2.54/autogen.sh
RUN ./libpng-1.2.54//configure
RUN make -j8
RUN make install
#DEBIAN_FRONTEND=noninteractive
#RUN dpkg -i libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python361/lib
RUN apt-get install -y libpython3.6
RUN pwd
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt install libgl1-mesa-glx -y
RUN apt-get install 'ffmpeg'\
'libsm6'\
'libxext6' -y
#RUN pip3 install --upgrade pip
#RUN pip3 install opencv-python==4.3.0.38
#RUN pip3 install -r requirements.txt
RUN apt-get install -y libglu1-mesa
RUN apt-get install -y libgtk2.0-0
RUN apt-get install -y x11-apps
ENV DISPLAY :0
#CMD ["./R2020a/bin/GMAT_Beta"]
#CMD ["./R2020a/bin/GmatConsole-R2020a"]
ENTRYPOINT ["/bin/bash"]
#docker build -t gmat:dev .
#docker run -it --name gmat01 --rm gmat:dev
#docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:dev
#docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --mount type=bind,source="$(pwd)",target=/app/data gmat:dev
#docker build -t gmat-console:dev .
#docker run -it --name gmat-console01 --rm gmat-console:dev arg1 arg2 ...
#docker run -it --name gmat-console01 --rm --mount type=bind,source="$(pwd)",target=/app/data gmat-console:dev
#docker run -it --name gmat-console01 --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --mount type=bind,source="$(pwd)",target=/app/data gmat-console:dev
#cd /app/data
#/app/R2020a/bin/GMAT_Beta --run Ex_Attitude_Inertial.script
#-> ok
#cd /app/data
#/app/R2020a/bin/GmatConsole-R2020a --run Ex_Attitude_Inertial.script
#-> ko
#/app/R2020a/bin/GmatConsole-R2020a --run data/Ex_Attitude_Inertial.script
#/home/tgateau/git/creme/creme-systeme/0_Simulation/GMAT_Application/GMAT/R2020a/bin/GmatConsole-R2020a --run MissionFromPython.script
#RUN add-apt-repository ppa:linuxuprising/libpng12
#RUN apt-get update
#RUN ldconfig
#RUN tar xvf libpng_1.2.54.orig.tar.gz
#RUN cd libpng-1.2.54
#RUN pwd
#RUN ls -al
#RUN ./autogen.sh
#RUN ./configure
#RUN make -j8
#RUN make install
#RUN apt-get install tree
#echo "deb http://ftp.us.debian.org/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
#echo "deb-src http://ftp.us.debian.org/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
#echo "deb http://security.debian.org/ jessie/updates main non-free contrib" >> /etc/apt/sources.list
#echo "deb-src http://security.debian.org/ jessie/updates main non-free contrib" >> /etc/apt/sources.list"
apt -y update
#RUN apt-get -y install libopengl0
RUN apt-get -y install dialog apt-utils
RUN apt-get -y install build-essential
RUN apt-get -y install zlib1g-dev
RUN cd libpng-1.2.54
RUN pwd
RUN ls -al
RUN ./libpng-1.2.54/autogen.sh
RUN ./libpng-1.2.54/configure
RUN make -j8
RUN make install
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt install libgl1-mesa-glx -y
RUN apt-get install -y libglu1-mesa
RUN apt-get install -y libgtk2.0-0
ENV DISPLAY :0
#RUN apt-get install 'ffmpeg'\
# 'libsm6'\
# 'libxext6' -y
# Firefox over VNC
#
# VERSION 0.1
# DOCKER-VERSION 0.2
FROM ubuntu:18.04
# Make sure the package repository is up to date
#RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
#docker build -t firefox:dev .
#docker run -p 5900:5900 -e HOME=/ firefox:dev x11vnc -forever -usepw -create
#docker run -p 5900:5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create
# GMAT with Docker: quickstart
```
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gitlab-registry.isae-supaero.fr/creme/creme-systeme/gmat:dev
```
# GMAT with Docker: generate docker locally and run it
## old
```
cd ~/git/creme/creme-systeme/0_Simulation/GMAT_Application
docker build -t gmat:dev .
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:dev
```
## console
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:gui bash
## with GUI:
```
cd ~/git/creme/creme-systeme/0_Simulation/GMAT_Application
docker build -t gmat:gui .
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:gui bash
/app/R2020a/bin/GMAT_Beta
```
## with GUI and bind:
```
docker run -it --mount type=bind,source=/home/tgateau/git/creme/creme-systeme/0_Simulation/Python/Output_Lite,target=/app/Output_Lite --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY gmat:gui bash
/app/R2020a/bin/GMAT_Beta
#bug in gmat
```
## with console and bind and root:
docker run -it --mount type=bind,source=/home/tgateau/git/creme/creme-systeme/0_Simulation/Python/Output_Lite,target=/app/Output_Lite --rm gmat:gui bash
cd Output_Lite
/app/R2020a/bin/GmatConsole --run MissionFromPython.script
#with bind
docker container run -it --mount type=bind,source=/home/tgateau/git/creme/creme-systeme/0_Simulation/Python/Output_Lite,target=/app/Output_Lite gmat:dev /bin/bash
cd Output_Lite
## in console
cd /app/R2020a/bin/
./GmatConsole --run /app/Output_Lite/MissionFromPython.script
#docker debug
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -u root gmat:gui bash #display with no work with '-u root'
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY fr3nd/xeyes
# GMAT with Docker in console mode: generate docker locally and run it
```
cd ~/git/creme/creme-systeme/0_Simulation/GMAT_Application
docker build -t gmatConsole:dev .
docker run -it --rm -v gmatConsole:dev
```
# push docker container on gitlab
```
cd ~/git/creme/creme-systeme/0_Simulation/GMAT_Application
docker login gitlab-registry.isae-supaero.fr
docker build -t gitlab-registry.isae-supaero.fr/creme/creme-systeme/gmat:dev .
docker push gitlab-registry.isae-supaero.fr/creme/creme-systeme/gmat:dev
```
# Troubleshooting
## test if X server with docker is working
```
cd ~/git/creme/creme-systeme/0_Simulation/GMAT_Application/xeyes
docker build -t xeyes:dev .
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY xeyes:dev
```
## docker troubles
The docker exec command is probably what you are looking for; this will let you run arbitrary commands inside an existing container. For example:
docker exec -it <mycontainer> bash
cd /home/tgateau/git/creme/creme-systeme/0_Simulation/
docker container run -it gmat:dev /bin/bash
docker container run -it --mount type=bind,source=/home/tgateau/git/creme/creme-systeme/0_Simulation/GMAT/Cubesat_DO_NOT_MODIFY,target=/app/Cubesat_DO_NOT_MODIFY gmat:dev /bin/bash
FROM debian:jessie
RUN apt-get update && \
apt-get install -y x11-apps
ENV DISPLAY :0
CMD xeyes
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