-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
155 lines (127 loc) · 5.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#FROM centos:centos6
FROM centos:centos7
#MAINTAINER Naoya Murakami <[email protected]>
MAINTAINER Kensuke Mitsuzawa <[email protected]>
# set root user setting
RUN echo 'root:docker' | chpasswd
RUN echo "root ALL=(ALL) ALL" >> /etc/sudoers
RUN echo "#Defaults requiretty" >> /etc/sudoers
#CMD "sh" "-c" "echo nameserver 8.8.8.8 > /etc/resolv.conf"
RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
RUN rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
RUN yum makecache
RUN yum install -y wget tar vi bzip2
RUN yum install -y gcc make gcc-c++
RUN yum install -y perl perl-devel
# dev tools
RUN yum -y install git vim
RUN yum -y install passwd openssh openssh-server openssh-clients sudo
RUN yum -y install zip
RUN yum -y install unzip
RUN yum -y install curl xz
RUN yum -y install python-devel.x86_64
RUN yum -y install patch
RUN yum -y install file
RUN yum -y install openssl
#RUN yum install -y nkf
RUN yum localinstall -y http://mirror.centos.org/centos/6/os/x86_64/Packages/nkf-2.0.8b-6.2.el6.x86_64.rpm
# for debian
#RUN apt-get update
#RUN apt-get install locales
#RUN apt-get install -y wget tar vim nkf bzip2
#RUN apt-get install -y gcc make g++
#RUN apt-get install -y perl libperl-dev
# Mecab
#RUN yum -y install mecab mecab-ipadic
#RUN wget http://mecab.googlecode.com/files/mecab-0.996.tar.gz
RUN wget -O mecab-0.996.tar.gz "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE"
RUN tar -xzf mecab-0.996.tar.gz
RUN cd mecab-0.996; ./configure --enable-utf8-only; make; make install; ldconfig
# Ipadic
#RUN wget http://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz
RUN wget -O mecab-ipadic-2.7.0-20070801.tar.gz "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM"
RUN tar -xzf mecab-ipadic-2.7.0-20070801.tar.gz
RUN cd mecab-ipadic-2.7.0-20070801; ./configure --with-charset=utf8; make; make install
RUN echo "dicdir = /usr/local/lib/mecab/dic/ipadic" > /usr/local/etc/mecabrc
# Ipadic_model
#RUN wget http://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.model.bz2
#RUN bzip2 -d mecab-ipadic-2.7.0-20070801.model.bz2
#RUN iconv -f EUCJP -t UTF-8 mecab-ipadic-2.7.0-20070801.model -o mecab-ipadic-2.7.0-20070801.model
#RUN nkf --overwrite -Ew mecab-ipadic-2.7.0-20070801.model
#RUN sed -i -e "s/euc-jp/utf-8/g" mecab-ipadic-2.7.0-20070801.model
# MeCab python binding
#COPY ./dockerfiles/mecab-python-0.996.tar.gz /
#RUN tar -xvf /mecab-python-0.996.tar.gz
#WORKDIR mecab-python-0.996
#RUN python2.7 setup.py build
#RUN python2.7 setup.py install
#WORKDIR /
#RUN rm -rf mecab-python-0.996.tar.gz
RUN yum -y install epel-release
RUN yum -y install python-pip --enablerepo=epel
RUN pip install mecab-python
# Mecab-perl
#RUN wget http://mecab.googlecode.com/files/mecab-perl-0.996.tar.gz
COPY ./dockerfiles/mecab-perl-0.996.tar.gz ./
RUN tar -xzf mecab-perl-0.996.tar.gz
RUN cd mecab-perl-0.996 ;perl Makefile.PL; make ;make install;
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/mecab.conf
RUN ldconfig
# TermExtract
RUN wget http://gensen.dl.itc.u-tokyo.ac.jp/soft/TermExtract-4_10.tar.gz
RUN tar -xzf TermExtract-4_10.tar.gz
RUN nkf --overwrite -Ew /TermExtract-4_10/TermExtract/MeCab.pm
RUN cd TermExtract-4_10 ;perl Makefile.PL; make ;make install;
# Add perl script
ADD ./dockerfiles/termextract_mecab_custom.pl /usr/local/bin/termextract_mecab.pl
RUN chmod 755 /usr/local/bin/termextract_mecab.pl
VOLUME ["/var/lib/termextract"]
COPY ./dockerfiles/pre_filter.txt /var/lib/termextract/
COPY ./dockerfiles/post_filter.txt /var/lib/termextract/
# Clean up
RUN rm -rf mecab-0.996.tar.gz*
RUN rm -rf mecab-ipadic-2.7.0-20070801.tar.gz*
RUN rm -rf mecab-perl-0.996.tar.gz*
RUN rm -rf TermExtract-4_10.tar.gz*
# neologd dictionary
RUN wget --no-check-certificate https://github.com/neologd/mecab-ipadic-neologd/tarball/master -O mecab-ipadic-neologd.tar
RUN tar -xvf mecab-ipadic-neologd.tar
RUN rm mecab-ipadic-neologd.tar
RUN mv neologd-mecab-ipadic-neologd-* neologd-mecab-ipadic-neologd
RUN cd neologd-mecab-ipadic-neologd && ( echo yes | ./bin/install-mecab-ipadic-neologd )
RUN echo "探偵ナイトスクープはおもしろい" | mecab -d /usr/local/lib/mecab/dic/mecab-ipadic-neologd/
# set new directories
RUN mkdir /analysis_data
RUN chmod 777 /analysis_data
RUN mkdir /testFiles
COPY ./dockerfiles/resources/* /testFiles/
RUN chmod 777 -R /testFiles
# copy python modules
RUN mkdir /analysis_code
COPY ./dockerfiles/python_modules/*py /analysis_code/
RUN touch /analysis_data/termExtractDict.csv
RUN chmod 777 -R /analysis_code
# make settings directory
RUN mkdir /settings
COPY ./dockerfiles/settings/* /settings/
RUN chmod 777 /settings
# -----------------------------------------------------
# if you need ssh connection please execute without comment
# Add script for ssh
#RUN yum -y install initscripts MAKEDEV
#RUN yum check
#RUN yum -y update
#RUN yum -y install openssh-server
#RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
#RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
#RUN useradd docker
#RUN echo 'docker:docker' | chpasswd
#RUN echo "docker ALL=(ALL) ALL" >> /etc/sudoers
#RUN sed -ri 's/^#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
# ssh setting
#EXPOSE 22
#RUN sed -i -e 's/UsePrivilegeSeparation.*$/UsePrivilegeSeparation no/g' /etc/ssh/sshd_config
#CMD /usr/sbin/sshd -D