forked from synesthesiam/voice2json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
145 lines (100 loc) · 4 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
FROM ubuntu:eoan as build-amd64
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${PROXY}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
python3 python3-dev python3-setuptools python3-pip python3-venv \
build-essential swig libatlas-base-dev portaudio19-dev \
curl ca-certificates
# -----------------------------------------------------------------------------
FROM ubuntu:eoan as build-armv7
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${PROXY}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
python3 python3-dev python3-setuptools python3-pip python3-venv \
build-essential swig libatlas-base-dev portaudio19-dev \
curl ca-certificates
# -----------------------------------------------------------------------------
FROM ubuntu:eoan as build-arm64
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${PROXY}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
python3 python3-dev python3-setuptools python3-pip python3-venv \
build-essential swig libatlas-base-dev portaudio19-dev \
curl ca-certificates
# -----------------------------------------------------------------------------
FROM balenalib/raspberry-pi-debian-python:3.7-buster-build-20200604 as build-armv6
ENV LANG C.UTF-8
# IFDEF PROXY
#! RUN echo 'Acquire::http { Proxy "http://${PROXY}"; };' >> /etc/apt/apt.conf.d/01proxy
# ENDIF
RUN install_packages \
swig libatlas-base-dev portaudio19-dev curl ca-certificates
# -----------------------------------------------------------------------------
ARG TARGETARCH
ARG TARGETVARIANT
FROM build-$TARGETARCH$TARGETVARIANT as build
ENV APP_DIR=/usr/lib/voice2json
ENV BUILD_DIR=/build
# Directory of prebuilt tools
COPY download/ ${BUILD_DIR}/download/
COPY m4/ ${BUILD_DIR}/m4/
COPY configure config.sub config.guess \
install-sh missing aclocal.m4 \
Makefile.in setup.py.in voice2json.sh.in voice2json.spec.in \
requirements.txt \
${BUILD_DIR}/
RUN cd ${BUILD_DIR} && \
./configure --enable-in-place --prefix=${APP_DIR}/.venv
COPY scripts/install/ ${BUILD_DIR}/scripts/install/
# IFDEF PYPI
#! ENV PIP_INDEX_URL=http://${PYPI}/simple/
#! ENV PIP_TRUSTED_HOST=${PYPI_HOST}
# ENDIF
RUN cd ${BUILD_DIR} && \
make && \
make install
# Strip binaries and shared libraries
RUN (find ${APP_DIR} -type f -name '*.so*' -print0 | xargs -0 strip --strip-unneeded -- 2>/dev/null) || true
RUN (find ${APP_DIR} -type f -executable -print0 | xargs -0 strip --strip-unneeded -- 2>/dev/null) || true
# -----------------------------------------------------------------------------
FROM ubuntu:eoan as run
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
python3 \
libportaudio2 libatlas3-base libgfortran4 \
ca-certificates \
perl sox alsa-utils espeak jq
# -----------------------------------------------------------------------------
FROM run as run-amd64
FROM run as run-armv7
FROM run as run-arm64
FROM balenalib/raspberry-pi-debian-python:3.7-buster-run-20200604 as run-armv6
ENV LANG C.UTF-8
RUN install_packages \
libportaudio2 libatlas3-base libgfortran4 \
ca-certificates \
perl sox alsa-utils espeak jq
# -----------------------------------------------------------------------------
ARG TARGETARCH
ARG TARGETVARIANT
FROM run-$TARGETARCH$TARGETVARIANT
ENV APP_DIR=/usr/lib/voice2json
COPY --from=build ${APP_DIR}/ ${APP_DIR}/
COPY --from=build /build/voice2json.sh ${APP_DIR}/
COPY etc/profile.defaults.yml ${APP_DIR}/etc/
COPY etc/precise/ ${APP_DIR}/etc/precise/
COPY site/ ${APP_DIR}/site/
COPY bin/voice2json ${APP_DIR}/bin/
COPY VERSION ${APP_DIR}/
COPY voice2json/ ${APP_DIR}/voice2json/
ENTRYPOINT ["bash", "/usr/lib/voice2json/voice2json.sh"]