-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (65 loc) · 2.15 KB
/
Dockerfile
File metadata and controls
77 lines (65 loc) · 2.15 KB
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
ARG DEBIAN_BASE=bullseye
FROM debian:${DEBIAN_BASE}-slim AS debian-base
RUN echo "APT::Get::Assume-Yes \"true\";\nAPT::Get::allow \"true\";" | tee -a /etc/apt/apt.conf.d/90_no_prompt && \
echo "APT::Keep-Downloaded-Packages \"false\";" | tee -a /etc/apt/apt.conf.d/91_no_cache && \
apt-get update
# Stage 1: Build OpenFST 1.7.2 from source
FROM debian-base as openfst-builder
ARG OPENFST_VERSION=1.7.2
ARG JOBS=4
# Install build dependencies for OpenFST
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
g++ \
make \
ccache \
&& rm -rf /var/lib/apt/lists/*
# Copy and build OpenFST from local tarball
WORKDIR /tmp
COPY ext/openfst-${OPENFST_VERSION}.tar.gz /tmp/
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
PATH=/usr/lib/ccache:${PATH} \
tar -xzf openfst-${OPENFST_VERSION}.tar.gz && \
cd openfst-${OPENFST_VERSION} && \
./configure --prefix=/opt/openfst --enable-shared --enable-static && \
make -j${JOBS} && \
make install && \
cd .. && \
rm -rf openfst-${OPENFST_VERSION} openfst-${OPENFST_VERSION}.tar.gz
# Stage 2: Build fstalign
FROM debian-base
COPY --from=openfst-builder /opt/openfst /opt/openfst
ENV OPENFST_ROOT /opt/openfst
ARG JOBS=4
# Install runtime and build dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
cmake \
g++ \
make \
ccache \
libicu-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /fstalign
COPY CMakeLists.txt /fstalign/CMakeLists.txt
COPY src /fstalign/src
COPY test /fstalign/test
COPY third-party /fstalign/third-party
COPY sample_data /fstalign/sample_data
WORKDIR /fstalign
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
PATH=/usr/lib/ccache:${PATH} \
mkdir -p /fstalign/build && \
cd /fstalign/build && \
rm -rf * && \
cmake .. -DOPENFST_ROOT="${OPENFST_ROOT}" -DDYNAMIC_OPENFST=OFF && \
make -j${JOBS} VERBOSE=1 && \
mkdir -p /fstalign/bin && \
cp /fstalign/build/fstalign /fstalign/bin && \
strip /fstalign/bin/*
COPY tools /fstalign/tools
ENV PATH \
/fstalign/bin/:\
$PATH