Commit 5c234cfa authored by delanoe's avatar delanoe

[INSTALL] Docker file.

parent 27f545d2
#A quick way to recover space (assuming site is running)
sudo docker rm `docker ps -a | grep Exited | awk '{print $1 }'`
sudo docker rmi `docker images -aq`
# list all containers
docker ps -a
# remove a container
docker rm $container_id
......@@ -8,11 +8,11 @@
###########################################################
######################################################################
FROM debian:stretch
#FROM gargantext
#FROM debian:stretch
FROM gargantext
MAINTAINER ISCPIF <alexandre.delanoe@iscpif.fr>
######################################################################
#
USER root
RUN apt-get update && \
......@@ -20,7 +20,7 @@ RUN apt-get update && \
apt-utils ca-certificates locales \
sudo aptitude gcc g++ wget git postgresql-9.5 vim
## Configure timezone and locale
### Configure timezone and locale
RUN echo "Europe/Paris" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen && \
......@@ -29,8 +29,8 @@ RUN echo "Europe/Paris" > /etc/timezone && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=fr_FR.UTF-8
## Install Database, main dependencies and Python
## (installing some Debian version before pip to get dependencies)
### Install Database, main dependencies and Python
### (installing some Debian version before pip to get dependencies)
RUN apt-get update && apt-get install -y \
postgresql-server-dev-9.5 libpq-dev libxml2 \
libxml2-dev xml-core libgfortran-5-dev \
......@@ -44,80 +44,21 @@ RUN apt-get update && apt-get install -y \
libxml2-dev libxslt-dev
# ^ for lxml
## PROD VERSION OF GARGANTEXT ONLY
### PROD VERSION OF GARGANTEXT ONLY
#RUN apt-get install -y uwsgi nginx uwsgi-plugin-python rabbitmq-server
# ## CREATE USER and adding it to sudo
# ## TODO ask user for password
#
## ## CREATE USER and adding it to sudo
## ## TODO ask user for password
RUN adduser --disabled-password --gecos "" gargantua
RUN apt-get install -y sudo && adduser gargantua sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# FIXME, it depends on postgres configuration
VOLUME ["/srv","/var"]
# Create directories in /srv
# FIXME: not tested
RUN for dir in "/srv/gargantext"\
"/srv/gargantext_lib"\
"/srv/gargantext_static"\
"/srv/gargantext_media"\
"/srv/env_3-5"\
"/var/www/gargantext"; do \
mkdir -p $dir ;\
chown gargantua:gargantua $dir ; \
done ;\
echo "Root: END of the installation of Gargantext by Root." ;
######################################################################
## CONFIGURE POSTGRESQL
######################################################################
USER postgres
RUN /etc/init.d/postgresql start &&\
psql -c "CREATE user gargantua WITH PASSWORD 'C8kdcUrAQy66U'" &&\
createdb -O gargantua gargandb \
&& echo "Root: END of the installation of Gargantexts Database by postgres."
######################################################################
## INSTALL MAIN DEPENDENCIES
######################################################################
#USER gargantua
#
#
## Installing pip version of python libs
## Possible FIXME : if `pip install -r requirements.txt` fails
## then: fixme >> maybe (split the list)
## else: enjoy
#
## TODO: user local file requirements with docker (and not wget)
#
#RUN wget http://dl.delanoe.org/requirements.txt -o /tmp/requirements.txt \
# && /usr/bin/virtualenv --py=/usr/bin/python3.5 env_3-5 \
# && /bin/bash -c 'source env_3-5/bin/activate' \
# && /bin/bash -c 'env_3-5/bin/pip install git+https://github.com/zzzeek/sqlalchemy.git@rel_1_1' \
# && /bin/bash -c 'env_3-5/bin/pip install -r /tmp/requirements.txt'
#
## GET CONFIG FILES (need update)
#WORKDIR /tmp
#RUN wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \
# && tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
# && chown -R gargantua:gargantua /srv/gargantext_lib \
# && echo "Root: END of the installation of Gargantexts Database by postgres."
# TODO script pour peupler la base
######################################################################
# Last step as user:
## TODO (soon) : git clone https://gogs.iscpif.fr/gargantext.git
#RUN git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
# && cd /srv/gargantext \
# && git fetch origin refactoring \
# && git checkout refactoring
#######################################################################
### CONFIGURE POSTGRESQL
#######################################################################
RUN sed -iP 's%^data_directory.*%data_directory = '\/srv\/gargantext_data'%' /etc/postgresql/9.5/main/postgresql.conf
######################################################################
#!/bin/bash
sudo docker export $(sudo docker ps -l | awk '{print $1}' | grep -v CONTAINER | head -n 1) > /tmp/gargantext_docker_image.tar
# To import the docker
#sudo docker import - gargantext:latest < data.tar
#sudo cat data.tar | docker import - gargantext
#/bin/bash
# in progress
## Quick Manual
## Install docker.io && sudo
## sudo docker build -t gargantext .
## docker run -i -t gargantext /bin/bash
# Install Docker
# Debian/Ubuntu: apt-get install docker
# run turboparser port, with python 3.4
#docker run -d -p 8000:8000 -v /srv:/srv -t gargantext python /srv/gargantext/gargantext.py
# launch
#cd /srv/gargantext
#source /srv/env_3-5/bin/activate &&
#docker run -d -p 8000:8000 -v /srv:/srv -t gargantext python /srv/gargantext/gargantext.py
#######################################################################
#sudo adduser --disabled-password --gecos "" gargantua
### Create directories in /srv
### FIXME: not tested
#for dir in "/srv/gargantext"\
# "/srv/gargantext_lib"\
# "/srv/gargantext_static"\
# "/srv/gargantext_media"\
# "/srv/gargantext_data"\
# "/srv/env_3-5"\
# "/var/www/gargantext"; do \
# sudo mkdir -p $dir ;\
# sudo chown gargantua:gargantua $dir ; \
#done
#
#######################################################################
## Last step as user:
### TODO (soon) : git clone https://gogs.iscpif.fr/gargantext.git
#git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
# && cd /srv/gargantext \
# && git fetch origin refactoring \
# && git checkout refactoring
#
######################################################################
# ____ _
# | _ \ ___ ___| | _____ _ __
# | | | |/ _ \ / __| |/ / _ \ '__|
# | |_| | (_) | (__| < __/ |
# |____/ \___/ \___|_|\_\___|_|
#
######################################################################
sudo docker build -t gargantext .
# OR
# cd /tmp
# wget http://dl.gargantext.org/gargantext_docker_image.tar \
# && sudo docker import - gargantext:latest < gargantext_docker_image.tar
######################################################################
# ____ _
# | _ \ ___ ___| |_ __ _ _ __ ___ ___
# | |_) / _ \/ __| __/ _` | '__/ _ \/ __|
# | __/ (_) \__ \ || (_| | | | __/\__ \
# |_| \___/|___/\__\__, |_| \___||___/
# |___/
######################################################################
#
# sudo chown -R postgres:postgres /srv/gargantext_data/ \
# su postgres -c '/usr/lib/postgresql/9.5/bin/initdb -D /srv/gargantext_data/'
#
# sudo /etc/init.d/postgresql start \
# && psql -c "CREATE user gargantua WITH PASSWORD 'C8kdcUrAQy66U'" \
# && createdb -O gargantua gargandb \
# && echo "Root: END of the installation of Gargantexts Database by postgres."
#
######################################################################
# _ _ _ _ _
# | | (_) |__ _ __ __ _(_)_ __(_) ___ ___
# | | | | '_ \| '__/ _` | | '__| |/ _ \/ __|
# | |___| | |_) | | | (_| | | | | | __/\__ \
# |_____|_|_.__/|_| \__,_|_|_| |_|\___||___/
#
######################################################################
######################################################################
## INSTALL MAIN DEPENDENCIES
######################################################################
#USER gargantua
##
##
### Installing pip version of python libs
#WORKDIR /home/gargantua
#
#RUN /usr/bin/virtualenv --py=/usr/bin/python3.5 /srv/env_3-5 \
# && /bin/bash -c 'source /srv/env_3-5/bin/activate' \
# && /bin/bash -c '/srv/env_3-5/bin/pip install git+https://github.com/zzzeek/sqlalchemy.git@rel_1_1' \
# && /bin/bash -c '/srv/env_3-5/bin/pip install -r /srv/gargantext/install/python/requirements.txt'
#
# TODO script pour peupler la base
## GET CONFIG FILES (need update)
#wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \
# && tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
# && chown -R gargantua:gargantua /srv/gargantext_lib \
# && echo "Libs installed"
#
#!/bin/bash
sudo docker run -i -p 8000:8000 \
-v /srv:/srv \
-v /home/alexandre:/home/alexandre \
-t gargantext:latest \
/bin/bash
#sudo docker run -i --name srv -v /srv:/srv -t gargantext:latest /bin/bash
../../python/requirements.txt
\ No newline at end of file
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