Commit 5d2aff7c authored by Romain Loth's avatar Romain Loth

stub for dockerization

parent 13b4ca1f
# to run docker client without sudo
sudo usermod -aG docker
# then full reboot
# to make a docker with the data
# src: hub.docker.com/r/mysql/mysql-server/
mkdir ../shared_mysql_data
docker create mysql
docker run --detach --name test_again \
-v /home/romain/comex/shared_mysql_data:/var/lib/mysql \
--env="MYSQL_ROOT_PASSWORD=mypassword" mysql
# get the ip
export SQLDOCKERIP=$(docker inspect test_again | jq -r '.[0].NetworkSettings.IPAddress')
# connect ---------------------------------------------
mysql -uroot -pmypassword -h $SQLDOCKERIP -P 3306
# -----------------------------------------------------
# NB
# also now mysqld --initilize created the following files
~/comex/shared_mysql_data > ll
total 185M
-rw-r----- 1 999 56 2016-11-23 17:49 auto.cnf
-rw-r----- 1 999 1,3K 2016-11-23 17:49 ib_buffer_pool
-rw-r----- 1 999 76M 2016-11-23 17:49 ibdata1
-rw-r----- 1 999 48M 2016-11-23 17:49 ib_logfile0
-rw-r----- 1 999 48M 2016-11-23 17:49 ib_logfile1
-rw-r----- 1 999 12M 2016-11-23 17:49 ibtmp1
drwxr-x--- 2 999 4,0K 2016-11-23 17:49 mysql/
drwxr-x--- 2 999 4,0K 2016-11-23 17:49 performance_schema/
drwxr-x--- 2 999 12K 2016-11-23 17:49 sys/
# --- after connection to mysql
CREATE DATABASE comex_shared ;
USE comex_shared ;
create table comex_registrations (
doors_uid char(36) not null unique,
-- ISO stamp like 2016-11-16T17:47:07.308Z
last_modified_date char(24) not null,
email varchar(255) not null unique primary key,
initials varchar(7) not null,
country varchar(60) not null,
first_name varchar(30) not null,
middle_name varchar(30),
last_name varchar(50) not null,
jobtitle varchar(30) not null,
keywords varchar(350) not null,
institution varchar(120) not null,
institution_type varchar(50) not null,
team_lab varchar(50),
institution_city varchar(50),
interests_text varchar(1200),
community_hashtags varchar(350),
gender char(1),
pic_file blob
) ;
FROM ubuntu:xenial
# based on https://github.com/egeland/docker-gunicorn-python3-flask/blob/master/Dockerfile
# MAINTAINER Frode Egeland <egeland@gmail.com>
# Base
ENV LANG fr_FR.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN locale-gen fr_FR fr_FR.UTF-8
RUN dpkg-reconfigure locales
# fine-tuning locales (src: gargantext)
# RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen && \
# sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
# dpkg-reconfigure --frontend=noninteractive locales && \
# echo 'LANG="fr_FR.UTF-8"' > /etc/default/locale
# ENV LANG fr_FR.UTF-8
# ENV LANGUAGE fr_FR.UTF-8
# ENV LC_ALL fr_FR.UTF-8
RUN apt-get update && apt-get autoclean
RUN apt-get install -y python3-pip git
# Install global dependencies
RUN pip3 install --upgrade pip
RUN pip3 install gunicorn flask
# pull the comex server from repository
RUN git clone https://github.com/moma/regcomex.git
# don't do this ( start the app at image build XD )
# WORKDIR /regcomex
# RUN gunicorn -b 127.0.0.1:9090 server_comex_registration:app
# but use the running script instead
# if Install gunicorn running script
# ADD run /usr/local/bin/run
# RUN chmod +x /usr/local/bin/run
# if REALLY needed virtualenv (TODO avoid it)
# RUN apt install python3-virtualenv
# RUN virtualenv --python=/usr/bin/python3 setup/regcomex_venv
# RUN setup/regcomex_venv/bin/activate && pip3 install -r setup/requirements.txt
# Volumes
# VOLUME ["/root/app/logs"]
# Ports
EXPOSE 5000:5000
EXPOSE 9090:9090
```bash
docker build flask_ispcif_light/ -t flask_ispcif_light:latest
docker run -it --name comex_flask_test flask_ispcif_light
```
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