-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
77 lines (65 loc) · 2.14 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
# For development
# (Preconfigured for VSCode)
FROM ubuntu:18.04 AS develop
LABEL MAINTAINER "amaya <[email protected]>"
RUN apt update \
&& apt install -y \
git make cmake clang-6.0 lldb-6.0 \
libboost-dev libboost-system-dev libboost-filesystem-dev \
python3-dev python3-pip \
libmecab-dev mecab-ipadic-utf8
RUN ln -s /usr/bin/clang++-6.0 /usr/bin/clang++ \
&& ln -s /usr/bin/lldb-6.0 /usr/bin/lldb \
&& ln -s /usr/bin/lldb-mi-6.0 /usr/bin/lldb-mi
RUN pip3 install numpy
# RUN apt install -y zsh
# ===== #
# A base iamge for release
FROM hoshizora/manylinux1-clang_x86_64:clang5 AS release-base
LABEL MAINTAINER "amaya <[email protected]>"
RUN set -eux \
&& `# ============ #` \
&& `# Install deps #` \
&& `# ============ #` \
&& yum update \
&& yum install -y boost148-devel boost148-filesystem boost148-system \
&& yum clean all \
&& rm -rf /var/cache/yum/* \
&& `#` \
&& `# ====================== #` \
&& `# Create links for cmake #` \
&& `# ====================== #` \
&& ln -s /usr/lib64/libboost_system.so.1.48.0 /usr/lib64/libboost_system-1_48.so \
&& ln -s /usr/lib64/libboost_system-mt.so.1.48.0 /usr/lib64/libboost_system-mt-1_48.so \
&& ln -s /usr/lib64/libboost_filesystem.so.1.48.0 /usr/lib64/libboost_filesystem-1_48.so \
&& ln -s /usr/lib64/libboost_filesystem-mt.so.1.48.0 /usr/lib64/libboost_filesystem-mt-1_48.so \
&& `#` \
&& `# ============= #` \
&& `# Install mecab #` \
&& `# ============= #` \
&& NCORES=$(grep -c ^processor /proc/cpuinfo 2> /dev/null) \
&& NPARS=$(($NCORES*2)) \
&& TMP_DIR=$(mktemp -d) \
&& cd $TMP_DIR \
&& git clone --depth 1 --single-branch -b master https://github.com/taku910/mecab.git \
&& cd mecab/mecab \
&& CC=gcc CXX=g++ ./configure \
&& make -j$NPARS \
&& make install \
&& cd \
&& rm -rf $TMP_DIR
# ===== #
# For release
FROM release-base AS release
ARG PYTHON_VERSION="37"
COPY . /app
WORKDIR /app
ENV CC=clang \
CXX=clang++ \
BOOST_INCLUDEDIR=/usr/include/boost148 \
PATH=/opt/python/cp${PYTHON_VERSION}-cp${PYTHON_VERSION}m/bin:$PATH
RUN set -eux \
&& make init \
&& pip install numpy \
&& python setup.py build \
&& python setup.py install