-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathDockerfile
69 lines (51 loc) · 2.09 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
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}
# Toolchain specification
#
# https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification
#
# <channel>[-<date>][-<host>]
#
# <channel> = stable|beta|nightly|<major.minor>|<major.minor.patch>
# <date> = YYYY-MM-DD
# <host> = <target-triple>
ARG RUST_TOOLCHAIN=stable
ARG HYPERSCAN_VERSION=5.4.0
ARG PCRE_VERSION=8.45
# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
curl \
libboost-dev \
libbz2-dev \
libpcap-dev \
ninja-build \
pkg-config \
python2.7 \
ragel \
wget \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain ${RUST_TOOLCHAIN} -y
ENV PATH=/root/.cargo/bin:$PATH
# Download Hyperscan
ENV HYPERSCAN_DIR=/hyperscan
RUN wget https://github.com/intel/hyperscan/archive/refs/tags/v${HYPERSCAN_VERSION}.tar.gz -O /hyperscan-${HYPERSCAN_VERSION}.tar.gz && \
mkdir ${HYPERSCAN_DIR} && tar xf /hyperscan-${HYPERSCAN_VERSION}.tar.gz -C ${HYPERSCAN_DIR} --strip-components=1 && rm /hyperscan-${HYPERSCAN_VERSION}.tar.gz
RUN wget https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz/download -O /pcre-${PCRE_VERSION}.tar.gz && \
mkdir ${HYPERSCAN_DIR}/pcre && tar xf /pcre-${PCRE_VERSION}.tar.gz -C ${HYPERSCAN_DIR}/pcre --strip-components=1 && rm /pcre-${PCRE_VERSION}.tar.gz
# Install Hyperscan
ENV INSTALL_DIR=/usr/local
RUN mkdir ${HYPERSCAN_DIR}/build && cd ${HYPERSCAN_DIR}/build && \
cmake -G Ninja -DBUILD_STATIC_LIBS=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${HYPERSCAN_DIR} && \
ninja && ninja install && mv ${HYPERSCAN_DIR}/build/lib/lib*.a ${INSTALL_DIR}/lib/ && cd / && rm -rf ${HYPERSCAN_DIR}
ENV PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
# Add rust-hyperscan code
ADD . /rust-hyperscan/
WORKDIR /rust-hyperscan
ENTRYPOINT ["cargo"]
CMD ["test", "-v", "--features", "static"]