|
1 |
| -FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 AS builder |
| 1 | +# BUILD redisfab/redisai-gpu:${VERSION}-${ARCH}-${OSNICK} |
2 | 2 |
|
3 |
| -ENV DEPS "build-essential git ca-certificates curl unzip wget libgomp1 patchelf" |
| 3 | +ARG REDIS_VER=5.0.7 |
| 4 | + |
| 5 | +# OSNICK=bionic|centos7|centos6 |
| 6 | +ARG OSNICK=bionic |
| 7 | + |
| 8 | +# ARCH=x64|arm64v8|arm32v7 |
| 9 | +ARG ARCH=x64 |
| 10 | + |
| 11 | +#---------------------------------------------------------------------------------------------- |
| 12 | +FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis |
| 13 | +FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 AS builder |
| 14 | + |
| 15 | +# ENV DEPS "git ca-certificates wget unzip cmake libgomp1 patchelf coreutils tcl libjemalloc-dev" |
4 | 16 | ENV NVIDIA_VISIBLE_DEVICES all
|
5 | 17 | ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
6 | 18 |
|
7 |
| -RUN apt update && apt -y upgrade |
8 |
| -RUN apt-get install -y libgomp1 |
9 |
| -RUN apt-get install -y wget |
10 |
| - |
11 |
| -RUN apt install -y build-essential tcl libjemalloc-dev |
12 |
| -RUN wget http://download.redis.io/redis-stable.tar.gz |
13 |
| -RUN tar xzvf redis-stable.tar.gz && cd redis-stable && make && make install && cd .. && rm redis-stable.tar.gz |
14 |
| - |
15 |
| -# install latest cmake |
16 |
| -ADD https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh /cmake-3.12.4-Linux-x86_64.sh |
17 |
| -RUN mkdir /opt/cmake |
18 |
| -RUN sh /cmake-3.12.4-Linux-x86_64.sh --prefix=/opt/cmake --skip-license |
19 |
| -RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake |
20 |
| -RUN cmake --version |
21 |
| - |
22 |
| -# Set up a build environment |
23 |
| -RUN set -ex;\ |
24 |
| - deps="$DEPS";\ |
25 |
| - apt-get update;\ |
26 |
| - apt-get install -y --no-install-recommends $deps |
27 |
| - |
28 |
| -# Get the dependencies |
29 |
| -WORKDIR /redisai |
30 |
| -ADD ./ /redisai |
31 |
| -RUN set -ex;\ |
32 |
| - mkdir -p deps;\ |
33 |
| - DEPS_DIRECTORY=deps bash ./get_deps.sh gpu |
34 |
| - |
35 |
| -# Configurations |
36 |
| -ADD http://download.redis.io/redis-stable/redis.conf /usr/local/etc/redis/redis.conf |
37 |
| -RUN sed -i 's/bind 127.0.0.1/bind 0.0.0.0/g' /usr/local/etc/redis/redis.conf |
38 |
| - |
39 |
| -# Build the source |
40 |
| -RUN set -ex;\ |
41 |
| - rm -rf build;\ |
42 |
| - mkdir -p build;\ |
43 |
| - cd build;\ |
44 |
| - cmake -DDEVICE=gpu ..;\ |
45 |
| - make && make install;\ |
46 |
| - cd .. |
47 |
| - |
48 |
| -# Package the runner |
49 |
| -FROM builder |
50 |
| - |
51 |
| -RUN mkdir -p /usr/lib/redis/modules/ |
52 |
| - |
53 |
| -COPY --from=builder /redisai/install-gpu/ /usr/lib/redis/modules/ |
| 19 | +WORKDIR /build |
| 20 | +COPY --from=redis /usr/local/ /usr/local/ |
| 21 | + |
| 22 | +COPY ./opt/ opt/ |
| 23 | +COPY ./test/test_requirements.txt test/ |
| 24 | + |
| 25 | +RUN ./opt/readies/bin/getpy |
| 26 | +RUN ./opt/system-setup.py |
| 27 | + |
| 28 | +ARG DEPS_ARGS="" |
| 29 | +COPY ./get_deps.sh . |
| 30 | +RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh gpu; else env $DEPS_ARGS ./get_deps.sh gpu; fi |
| 31 | + |
| 32 | +ARG BUILD_ARGS="" |
| 33 | +ADD ./ /build |
| 34 | +RUN make -C opt build GPU=1 $BUILD_ARGS SHOW=1 |
| 35 | + |
| 36 | +ARG PACK=0 |
| 37 | +ARG TEST=0 |
| 38 | + |
| 39 | +RUN if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi |
| 40 | +RUN if [ "$TEST" = "1" ]; then TEST="" make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1; fi |
| 41 | + |
| 42 | +#---------------------------------------------------------------------------------------------- |
| 43 | +FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 |
| 44 | + |
| 45 | +RUN set -e; apt-get -qq update; apt-get -q install -y libgomp1 |
| 46 | + |
| 47 | +ENV REDIS_MODULES /usr/lib/redis/modules |
| 48 | +RUN mkdir -p $REDIS_MODULES/ |
| 49 | + |
| 50 | +COPY --from=redis /usr/local/ /usr/local/ |
| 51 | +COPY --from=builder /build/install-gpu/ $REDIS_MODULES/ |
| 52 | +# COPY --from=builder /usr/local/etc/redis/redis.conf /usr/local/etc/redis/ |
54 | 53 |
|
55 | 54 | WORKDIR /data
|
56 | 55 | EXPOSE 6379
|
57 |
| -CMD ["redis-server", "/usr/local/etc/redis/redis.conf", "--loadmodule", "/usr/lib/redis/modules/redisai.so"] |
| 56 | +# CMD ["/usr/local/bin/redis-server", "/usr/local/etc/redis/redis.conf", "--loadmodule", "/usr/lib/redis/modules/redisai.so"] |
| 57 | +CMD ["/usr/local/bin/redis-server", "--loadmodule", "/usr/lib/redis/modules/redisai.so"] |
0 commit comments