docker环境构建(hyperscan 和 go )

查看hyperscan官网,需要如下图所示依赖:

由于本文是构建docker环境,直接上dockerfile:

FROM centos:7
RUN cd /etc/yum.repos.d && curl -O  http://mirrors.aliyun.com/repo/epel-7.repo
RUN yum clean all
RUN yum makecache
RUN  yum install -y git gcc clang cmake make gcc-c++  python2  libpcap

RUN mkdir -p /usr/local/include/ &&    cd /usr/local/include/ &&    curl -O http://www.colm.net/files/ragel/ragel-6.9.tar.gz &&    tar -zxf ragel-6.9.tar.gz && cd ragel-6.9 && ./configure && make && make install
RUN cd /usr/local/include/ &&  curl -L -O https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.gz &&   tar -zxf boost_1_69_0.tar.gz && export BOOST_ROOT=/usr/local/include/boost_1_69_0
ENV BOOST_ROOT=/usr/local/include/boost_1_69_0
RUN cd /usr/local/include/ &&         curl -L -O https://codeload.github.com/intel/hyperscan/tar.gz/refs/tags/v5.4.0 && tar -xzf hyperscan-5.4.0.tar.gz && cd hyperscan-5.4.0 && mkdir build && cd build && cmake ../ && cmake --build . && make install

RUN mkdir -vp /go/src && yum install -y golang 
ENV GOPATH=/go/ \
   PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/ \
   CGO_CFLAGS="-I/usr/local/include/hyperscan-5.4.0/src" \
   LIBRARY_PATH=/usr/local/include/hyperscan-5.4.0/build/lib \
   GOROOT=/usr/lib/golang/
WORKDIR /go/src

如果github下载失败,建议先下载boost_1_69_0和hyperscan-5.4.0,然后copy进去,dockerfile如下:

FROM centos:7
COPY ./epel/boost_1_69_0.tar.gz /usr/local/include/
COPY ./epel/hyperscan-5.4.0.tar.gz /usr/local/include/
RUN cd /etc/yum.repos.d && curl -O  http://mirrors.aliyun.com/repo/epel-7.repo
RUN yum clean all
RUN yum makecache
RUN yum install -y git gcc clang cmake make gcc-c++  python2  libpcap
RUN mkdir -p /usr/local/include/ &&    cd /usr/local/include/ &&    curl -O http://www.colm.net/files/ragel/ragel-6.9.tar.gz &&    tar -zxf ragel-6.9.tar.gz && cd ragel-6.9 && ./configure && make && make install
RUN cd /usr/local/include/ &&    tar -zxf boost_1_69_0.tar.gz && export BOOST_ROOT=/usr/local/include/boost_1_69_0
ENV BOOST_ROOT=/usr/local/include/boost_1_69_0
RUN cd /usr/local/include/ && tar -xzf hyperscan-5.4.0.tar.gz && cd hyperscan-5.4.0 && mkdir build && cd build && cmake ../ && cmake --build . && make install 
RUN mkdir -vp /go/src && yum install -y golang 
ENV GOPATH=/go/ \
   PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/ \
   CGO_CFLAGS="-I/usr/local/include/hyperscan-5.4.0/src" \
   LIBRARY_PATH=/usr/local/include/hyperscan-5.4.0/build/lib \
   GOROOT=/usr/lib/golang/
WORKDIR /go/src

你可能感兴趣的:(docker环境构建(hyperscan 和 go ))