Commit 2397605e6d9f6135e165d6dda78bc0696c7289ed
1 parent
f0568767
Exists in
coppe
Adicionando Dockerfile e modificações feitas pela coppe
Showing
5 changed files
with
86 additions
and
102 deletions
Show diff stats
Dockerfile
1 | FROM ubuntu:14.04 | 1 | FROM ubuntu:14.04 |
2 | MAINTAINER Jonathan Brilhante | 2 | MAINTAINER Jonathan Brilhante |
3 | -#USER root | ||
4 | 3 | ||
5 | -#Dependencies installation - RabbitMQ / Graylog / Nodejs | 4 | +COPY ./core/translator.py /home/vlibras/translator.py |
5 | +COPY ./core/renderer.py /home/vlibras/renderer.py | ||
6 | +COPY ./core/indexer.py /home/vlibras/indexer.py | ||
7 | +COPY ./core/PikaManager.py /home/vlibras/PikaManager.py | ||
8 | +COPY ./core/processManager.py /home/vlibras/processManager.py | ||
9 | +COPY ./core/logger.py /home/vlibras/logger.py | ||
10 | +COPY ./core/Trie.py /home/vlibras/Trie.py | ||
6 | 11 | ||
7 | -#Packages updates | ||
8 | -RUN apt-get -y update | ||
9 | -RUN apt-get -y upgrade | ||
10 | -RUN apt-get -y update | 12 | +COPY ./fonts/ /home/vlibras/fonts/ |
11 | 13 | ||
12 | -#Install necessary packages | ||
13 | -RUN apt-get install -y build-essential libssl-dev sudo curl wget | 14 | +COPY ./translate-api/ /home/vlibras/translate-api/ |
15 | +COPY ./bundles/ /home/vlibras/bundles/ | ||
14 | 16 | ||
15 | -#RUN apt-get install default-jdk -y | 17 | +COPY ./vlibras-translate/ /home/vlibras/vlibras-translate/ |
18 | +COPY ./vlibras-libs/ /home/vlibras/vlibras-libs/ | ||
19 | +COPY ./unityVideo/ /home/vlibras/unityVideo/ | ||
16 | 20 | ||
17 | -#Install Nodejs | ||
18 | -RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | ||
19 | -RUN apt-get install -y nodejs | ||
20 | - | ||
21 | -#Install python packages | ||
22 | -RUN apt-get install -y python-setuptools | ||
23 | -RUN easy_install pip | ||
24 | - | ||
25 | -#Install python and python lib for RabbitMQ | ||
26 | -RUN apt-get install -y python | ||
27 | -RUN pip install pika | ||
28 | - | ||
29 | -#Install Graylog | ||
30 | -RUN pip install graypy | ||
31 | -RUN pip install graypy[amqp] | ||
32 | - | ||
33 | -#Install aditional packages | ||
34 | -RUN apt-get install -y pkg-config libfreetype6-dev libpng-dev xvfb | ||
35 | -RUN apt-get install -y python-yaml libgomp1 python-numpy python-pyfits python-matplotlib idle | ||
36 | -RUN pip install nltk==3.0.5 nltk_tgrep --upgrade | ||
37 | -RUN pip install pysrt ffmpy pyvirtualdisplay | ||
38 | -RUN apt-get install -y software-properties-common | ||
39 | - | ||
40 | -#Install FFmpeg | ||
41 | -RUN add-apt-repository ppa:mc3man/trusty-media | ||
42 | -RUN apt-get -y update | ||
43 | -RUN apt-get install -y ffmpeg gstreamer0.10-ffmpeg | ||
44 | - | ||
45 | -WORKDIR /root/ | ||
46 | -RUN mkdir -p ./storage/libras | ||
47 | - | ||
48 | -#Copy workers to container | ||
49 | -COPY ./core/translator.py /root/translator.py | ||
50 | -COPY ./core/renderer.py /root/renderer.py | ||
51 | -COPY ./core/indexer.py /root/indexer.py | ||
52 | -COPY ./core/PikaManager.py /root/PikaManager.py | ||
53 | -COPY ./core/processManager.py /root/processManager.py | ||
54 | -COPY ./core/logger.py /root/logger.py | ||
55 | -COPY ./core/Trie.py /root/Trie.py | ||
56 | - | ||
57 | -COPY ./fonts/ /root/fonts/ | ||
58 | - | ||
59 | -COPY ./translate-api/ /root/translate-api/ | ||
60 | -COPY ./bundles/ /root/bundles/ | ||
61 | - | ||
62 | -COPY ./vlibras-translate/ /root/vlibras-translate/ | ||
63 | -COPY ./vlibras-libs/ /root/vlibras-libs/ | ||
64 | -COPY ./unityVideo/ /root/unityVideo/ | ||
65 | - | ||
66 | -#Workers environment variables | ||
67 | -ENV VLIBRAS_VIDEO_CREATOR="/root/unityVideo/videoCreator.x86_64" | ||
68 | -ENV VLIBRAS_VIDEO_LIBRAS="/root/storage/libras" | ||
69 | -ENV VLIBRAS_VIDEO_SCREENS="/root/storage/frames" | ||
70 | -ENV SIGNS_VLIBRAS="/root/bundles" | ||
71 | -ENV TEXT_FONTS="/root/fonts/FreeSans.ttf" | 21 | +ENV VLIBRAS_VIDEO_CREATOR="/home/vlibras/unityVideo/videoCreator.x86_64" |
22 | +ENV VLIBRAS_VIDEO_LIBRAS="/home/vlibras/storage/libras" | ||
23 | +ENV VLIBRAS_VIDEO_SCREENS="/home/vlibras/storage/frames" | ||
24 | +ENV SIGNS_VLIBRAS="/home/vlibras/bundles" | ||
25 | +ENV TEXT_FONTS="/home/vlibras/fonts/FreeSans.ttf" | ||
72 | 26 | ||
73 | #Translator environment variables | 27 | #Translator environment variables |
74 | -ENV HUNPOS_TAGGER="/root/vlibras-libs/aelius/bin/hunpos-tag" | ||
75 | -ENV AELIUS_DATA="/root/vlibras-libs/aelius/aelius_data" | ||
76 | -ENV TRANSLATE_DATA="/root/vlibras-translate/data" | ||
77 | -ENV NLTK_DATA="/root/vlibras-libs/aelius/nltk_data" | ||
78 | -ENV PYTHONPATH=":/root/vlibras-libs/aelius:/root/vlibras-translate/src:/root/vlibras-libs/aelius:/root/vlibras-translate/src" | ||
79 | - | ||
80 | -#Portas de comunicacao do container | ||
81 | -WORKDIR /root/translate-api/ | ||
82 | -RUN npm i | ||
83 | - | ||
84 | -#Comando de entrada quando inicializado | ||
85 | -ENTRYPOINT ( sleep 1m) ; npm start & python /root/processManager.py | 28 | +ENV HUNPOS_TAGGER="/home/vlibras/vlibras-libs/aelius/bin/hunpos-tag" |
29 | +ENV AELIUS_DATA="/home/vlibras/vlibras-libs/aelius/aelius_data" | ||
30 | +ENV TRANSLATE_DATA="/home/vlibras/vlibras-translate/data" | ||
31 | +ENV NLTK_DATA="/home/vlibras/vlibras-libs/aelius/nltk_data" | ||
32 | +ENV PYTHONPATH=":/home/vlibras/vlibras-libs/aelius:/home/vlibras/vlibras-translate/src:/home/vlibras/vlibras-libs/aelius:/home/vlibras/vlibras-translate/src" | ||
33 | + | ||
34 | +RUN apt-get update -y && \ | ||
35 | + apt-get install -y sudo curl wget software-properties-common && \ | ||
36 | + curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ | ||
37 | + add-apt-repository ppa:mc3man/trusty-media && \ | ||
38 | + apt-get -y update && \ | ||
39 | + apt-get install -y pkg-config libfreetype6-dev libpng-dev xvfb build-essential libssl-dev nodejs python-pip python-yaml libgomp1 python-numpy python-pyfits python-matplotlib idle ffmpeg gstreamer0.10-ffmpeg && \ | ||
40 | + pip install nltk==3.0.5 nltk_tgrep --upgrade && \ | ||
41 | + pip install pysrt ffmpy pyvirtualdisplay pika && \ | ||
42 | + groupadd -r vlibras && useradd -r -g vlibras vlibras && \ | ||
43 | + mkdir -p /home/vlibras/storage/libras | ||
44 | + | ||
45 | +WORKDIR /home/vlibras/translate-api/ | ||
46 | + | ||
47 | +COPY ./docker-entrypoint.sh / | ||
48 | + | ||
49 | +RUN npm i && \ | ||
50 | + mkdir -p /home/vlibras/translate-api/logs && \ | ||
51 | + chown -R vlibras. /home/vlibras && \ | ||
52 | + chmod +x /docker-entrypoint.sh && \ | ||
53 | + mkdir -p /storage && \ | ||
54 | + chown -R vlibras. /storage | ||
55 | + | ||
56 | +USER vlibras | ||
57 | + | ||
58 | +VOLUME ["/home/vlibras/translate-api/logs"] | ||
59 | +VOLUME ["/home/vlibras/storage"] | ||
60 | + | ||
61 | +EXPOSE 8080 | ||
62 | + | ||
63 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
core/processManager.py
@@ -16,7 +16,7 @@ def signalHandler(signal, frame): | @@ -16,7 +16,7 @@ def signalHandler(signal, frame): | ||
16 | 16 | ||
17 | def spawnRenderer(): | 17 | def spawnRenderer(): |
18 | while KEEP_RUNNING: | 18 | while KEEP_RUNNING: |
19 | - proc = subprocess.Popen(["/root/renderer.py"], shell=True, stdout=subprocess.PIPE) | 19 | + proc = subprocess.Popen(["/home/vlibras/renderer.py"], shell=True, stdout=subprocess.PIPE) |
20 | print("Process RENDERER PID: " + str(proc.pid)) | 20 | print("Process RENDERER PID: " + str(proc.pid)) |
21 | try: | 21 | try: |
22 | stdoutdata, stderrdata = proc.communicate() | 22 | stdoutdata, stderrdata = proc.communicate() |
@@ -26,7 +26,7 @@ def spawnRenderer(): | @@ -26,7 +26,7 @@ def spawnRenderer(): | ||
26 | 26 | ||
27 | def spawnTranslator(): | 27 | def spawnTranslator(): |
28 | while KEEP_RUNNING: | 28 | while KEEP_RUNNING: |
29 | - proc = subprocess.Popen(["/root/translator.py"], shell=True, stdout=subprocess.PIPE) | 29 | + proc = subprocess.Popen(["/home/vlibras/translator.py"], shell=True, stdout=subprocess.PIPE) |
30 | print("Process TRANSLATOR PID: " + str(proc.pid)) | 30 | print("Process TRANSLATOR PID: " + str(proc.pid)) |
31 | try: | 31 | try: |
32 | stdoutdata, stderrdata = proc.communicate() | 32 | stdoutdata, stderrdata = proc.communicate() |
@@ -36,7 +36,7 @@ def spawnTranslator(): | @@ -36,7 +36,7 @@ def spawnTranslator(): | ||
36 | 36 | ||
37 | def spawnIndexer(): | 37 | def spawnIndexer(): |
38 | while KEEP_RUNNING: | 38 | while KEEP_RUNNING: |
39 | - proc = subprocess.Popen(["/root/indexer.py"], shell=True, stdout=subprocess.PIPE) | 39 | + proc = subprocess.Popen(["/home/vlibras/indexer.py"], shell=True, stdout=subprocess.PIPE) |
40 | print("Process INDEXER PID: " + str(proc.pid)) | 40 | print("Process INDEXER PID: " + str(proc.pid)) |
41 | try: | 41 | try: |
42 | stdoutdata, stderrdata = proc.communicate() | 42 | stdoutdata, stderrdata = proc.communicate() |
docker-compose.yml
1 | version: '2' | 1 | version: '2' |
2 | - | 2 | +volumes: |
3 | + tradutor-rabbitmq: | ||
4 | + external: true | ||
5 | + driver: 'null' | ||
6 | + core_db: | ||
7 | + external: true | ||
8 | + driver: 'null' | ||
9 | + tradutor-bd: | ||
10 | + external: true | ||
11 | + driver: 'null' | ||
12 | + tradutor_logs: | ||
13 | + external: true | ||
14 | + driver: 'null' | ||
3 | services: | 15 | services: |
4 | - | ||
5 | mongo: | 16 | mongo: |
6 | image: mongo:3.0.4 | 17 | image: mongo:3.0.4 |
7 | volumes: | 18 | volumes: |
8 | - - /data/db | ||
9 | - ports: | ||
10 | - - "27017" | ||
11 | - | 19 | + - tradutor-bd:/data/db |
12 | rabbit: | 20 | rabbit: |
13 | - image: "rabbitmq:3-management" | ||
14 | - ports: | ||
15 | - - "15672" | ||
16 | - - "5672" | 21 | + image: rabbitmq:3-management |
17 | volumes: | 22 | volumes: |
18 | - - ./rabbitmq:/var/lib/rabbitmq | ||
19 | - | 23 | + - tradutor-rabbitmq:/var/lib/rabbitmq |
20 | api: | 24 | api: |
21 | - build: . | ||
22 | - links: | ||
23 | - - mongo | ||
24 | - - rabbit | ||
25 | - ports: | ||
26 | - - "80:80" | 25 | + image: hub.docker.planejamento.gov.br/vlibras/tradutor:coppe |
27 | volumes: | 26 | volumes: |
28 | - - core_db:/storage/ | ||
29 | - restart: always | 27 | + - core_db:/home/vlibras/storage/ |
28 | + - tradutor_logs:/home/vlibras/translate-api/logs | ||
29 | + links: | ||
30 | + - rabbit:rabbit | ||
31 | + - mongo:mongo | ||
32 | + labels: | ||
33 | + io.rancher.container.pull_image: always | ||
30 | 34 | ||
31 | -volumes: | ||
32 | - core_db: |
translate-api/bin/www
@@ -9,7 +9,7 @@ var http = require('http') | @@ -9,7 +9,7 @@ var http = require('http') | ||
9 | /** | 9 | /** |
10 | * Define the port and store in Express. | 10 | * Define the port and store in Express. |
11 | */ | 11 | */ |
12 | -const PORT = 80; | 12 | +const PORT = 8080; |
13 | app.set('port', PORT); | 13 | app.set('port', PORT); |
14 | 14 | ||
15 | /** | 15 | /** |