Commit 3a5c72008f2e5536a64889fa2068ed55e331022c

Authored by jonathan.brilhante
1 parent 69a12f48
Exists in master and in 1 other branch coppe

Alteração de privilegios - Usando usuário Vlibras

Showing 1 changed file with 32 additions and 43 deletions   Show diff stats
Dockerfile
1 1 FROM ubuntu:14.04
2 2 MAINTAINER Jonathan Brilhante
3   -#USER root
4 3  
5 4 #Dependencies installation - RabbitMQ / Graylog / Nodejs / Redis / MongoDB / FFmpeg
6 5  
7 6 #Packages updates
8   -RUN apt-get -y upgrade
9   -RUN apt-get -y update
  7 +RUN apt-get -y upgrade && apt-get -y update
10 8  
11 9 #Install necessary packages
12 10 RUN apt-get install -y build-essential libssl-dev sudo curl wget && apt-get clean
13 11  
14   -#RUN apt-get install default-jdk -y
15   -#RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
16   -
17 12 #Install Nodejs
18 13 RUN curl -sL https://deb.nodesource.com/setup | sudo 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   -#RUN npm install -g express-generator
26   -#RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-extra/ -e s/fs\.rename/fs.move/ ./lib/utils/rename.js
  14 +RUN apt-get install -y nodejs && apt-get clean
27 15  
28 16 #Install python and python lib for RabbitMQ
29   -RUN apt-get install -y python
  17 +RUN apt-get install -y python-setuptools python && apt-get clean && easy_install pip
30 18 RUN pip install pika
31 19  
32 20 #Install Graylog
... ... @@ -34,53 +22,54 @@ RUN pip install graypy
34 22 RUN pip install graypy[amqp]
35 23  
36 24 #Install aditional packages
37   -RUN apt-get install -y pkg-config libfreetype6-dev libpng-dev xvfb
38   -RUN apt-get install -y python-yaml libgomp1 python-numpy python-pyfits python-matplotlib idle
  25 +RUN apt-get install -y pkg-config libfreetype6-dev libpng-dev xvfb python-yaml libgomp1 python-numpy python-pyfits python-matplotlib idle && apt-get clean
39 26 RUN pip install nltk==3.0.5 nltk_tgrep --upgrade
40 27 RUN pip install pysrt pyvirtualdisplay
41   -RUN apt-get install -y software-properties-common
  28 +RUN apt-get install -y software-properties-common && apt-get clean
42 29  
43 30 #Install FFmpeg
44   -RUN add-apt-repository ppa:mc3man/trusty-media
45   -RUN apt-get -y update
46   -RUN apt-get install -y ffmpeg gstreamer0.10-ffmpeg
  31 +RUN add-apt-repository ppa:mc3man/trusty-media && apt-get -y update && apt-get install -y ffmpeg gstreamer0.10-ffmpeg && apt-get clean
  32 +
  33 +RUN groupadd -r vlibras && useradd -r -g vlibras vlibras
47 34  
48 35 WORKDIR /
49 36 RUN mkdir /storage/
50 37 RUN mkdir -p /storage/videos/
  38 +RUN chown -R vlibras /storage/
51 39  
  40 +USER vlibras
52 41 #Copy workers to container
53   -WORKDIR /root/
54   -ADD ./core/extractor.py /root/extractor.py
55   -ADD ./core/mixer.py /root/mixer.py
56   -ADD ./core/renderer.py /root/renderer.py
57   -ADD ./core/translator.py /root/translator.py
58   -ADD ./core/PikaManager.py /root/PikaManager.py
59   -ADD ./core/processManager.py /root/processManager.py
60   -ADD ./log/ /root/log/
61   -ADD ./unityVideo/ /root/unityVideo/
62   -ADD ./vlibras-translate/ /root/vlibras-translate/
63   -ADD ./vlibras-libs/ /root/vlibras-libs/
64   -ADD ./vlibras-api/ /root/vlibras-api/
  42 +WORKDIR /home/vlibras/
  43 +
  44 +ADD ./core/extractor.py /home/vlibras/extractor.py
  45 +ADD ./core/mixer.py /home/vlibras/mixer.py
  46 +ADD ./core/renderer.py /home/vlibras/renderer.py
  47 +ADD ./core/translator.py /home/vlibras/translator.py
  48 +ADD ./core/PikaManager.py /home/vlibras/PikaManager.py
  49 +ADD ./core/processManager.py /home/vlibras/processManager.py
  50 +ADD ./log/ /home/vlibras/log/
  51 +ADD ./unityVideo/ /home/vlibras/unityVideo/
  52 +ADD ./vlibras-translate/ /home/vlibras/vlibras-translate/
  53 +ADD ./vlibras-libs/ /home/vlibras/vlibras-libs/
  54 +ADD ./vlibras-api/ /home/vlibras/vlibras-api/
65 55  
66 56 #Workers environment variables
67   -ENV VLIBRAS_VIDEO_CREATOR="/root/unityVideo/videoCreator.x86_64"
  57 +ENV VLIBRAS_VIDEO_CREATOR="/home/vlibras/unityVideo/videoCreator.x86_64"
68 58 ENV VLIBRAS_VIDEO_LIBRAS="/storage/libras"
69 59 ENV VLIBRAS_VIDEO_MIXED="/storage/videos"
70 60 ENV VLIBRAS_VIDEO_SCREENS="/storage/frames"
71 61  
72 62 #Translator environment variables
73   -ENV HUNPOS_TAGGER="/root/vlibras-libs/aelius/bin/hunpos-tag"
74   -ENV AELIUS_DATA="/root/vlibras-libs/aelius/aelius_data"
75   -ENV TRANSLATE_DATA="/root/vlibras-translate/data"
76   -ENV NLTK_DATA="/root/vlibras-libs/aelius/nltk_data"
77   -ENV PYTHONPATH=":/root/vlibras-libs/aelius:/root/vlibras-translate/src:/root/vlibras-libs/aelius:/root/vlibras-translate/src"
78   -
79   -#ENV NODE_PATH=/root/vlibras-api/node_modules/;%NODE_PATH%
  63 +ENV HUNPOS_TAGGER="/home/vlibras/vlibras-libs/aelius/bin/hunpos-tag"
  64 +ENV AELIUS_DATA="/home/vlibras/vlibras-libs/aelius/aelius_data"
  65 +ENV TRANSLATE_DATA="/home/vlibras/vlibras-translate/data"
  66 +ENV NLTK_DATA="/home/vlibras/vlibras-libs/aelius/nltk_data"
  67 +ENV PYTHONPATH=":/home/vlibras/vlibras-libs/aelius:/home/vlibras/vlibras-translate/src"
80 68  
81 69 #Portas de comunicacao do container
82   -WORKDIR /root/vlibras-api/
  70 +WORKDIR /home/vlibras/vlibras-api/
83 71  
  72 +USER root
84 73 RUN npm cache clean
85 74 RUN rm -rf node_modules
86 75 RUN npm i
... ... @@ -89,4 +78,4 @@ RUN npm --version
89 78 RUN node --version
90 79  
91 80 #Comando de entrada quando inicializado
92   -ENTRYPOINT (sleep 1m) ; (node /root/vlibras-api/server.js & sleep 10) ; python /root/processManager.py
  81 +ENTRYPOINT (sleep 1m) ; (node /home/vlibras/vlibras-api/server.js & sleep 10) ; python /home/vlibras/processManager.py
... ...