forked from Spartee/RedisAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.gpu
95 lines (67 loc) · 2.78 KB
/
Dockerfile.gpu
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
# BUILD redisfab/redisai:${VERSION}-gpu-${ARCH}-${OSNICK}
ARG REDIS_VER=6.0.9
# OSNICK=bionic|centos7|centos6
ARG OSNICK=bionic
# OS=ubuntu18.04|ubuntu16.04|centos7
ARG OS=ubuntu18.04
# ARCH=x64|arm64v8|arm32v7
ARG ARCH=x64
ARG CUDA_VER=11.0-cudnn8
ARG PACK=0
ARG TEST=0
#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
FROM nvidia/cuda:10.2-cudnn8-devel-${OS} AS cuda_10.2
FROM nvidia/cuda:${CUDA_VER}-devel-${OS} AS builder
ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
ARG CUDA_VER
RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
WORKDIR /build
COPY --from=redis /usr/local/ /usr/local/
COPY --from=cuda_10.2 /usr/local/cuda-10.2 /usr/local/cuda-10.2
COPY --from=cuda_10.2 /usr/lib/x86_64-linux-gnu/libcu* /usr/lib/x86_64-linux-gnu/
RUN echo export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda-11.0/lib64:/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH > /etc/profile.d/cuda.sh
COPY ./opt/ opt/
COPY ./tests/flow/test_requirements.txt tests/flow/
RUN FORCE=1 ./opt/readies/bin/getpy3
RUN ./opt/system-setup.py
ARG DEPS_ARGS=""
COPY ./get_deps.sh .
RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh gpu; else env $DEPS_ARGS ./get_deps.sh gpu; fi
ARG BUILD_ARGS=""
ADD ./ /build
RUN bash -l -c "make -C opt build GPU=1 $BUILD_ARGS SHOW=1"
ARG PACK
ARG TEST
RUN mkdir -p bin/artifacts
RUN set -e ;\
if [ "$PACK" = "1" ]; then bash -l -c "make -C opt pack GPU=1"; fi
RUN set -e ;\
if [ "$TEST" = "1" ]; then \
bash -l -c "TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1" ;\
if [[ -d test/logs ]]; then \
tar -C test/logs -czf bin/artifacts/test-logs-gpu.tgz . ;\
fi ;\
fi
#----------------------------------------------------------------------------------------------
FROM nvidia/cuda:${CUDA_VER}-runtime-${OS}
ARG OS
RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi
RUN if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi
ENV REDIS_MODULES /usr/lib/redis/modules
RUN mkdir -p $REDIS_MODULES/
COPY --from=redis /usr/local/ /usr/local/
COPY --from=builder /usr/local/cuda-10.2 /usr/local/cuda-10.2
COPY --from=builder /usr/lib/x86_64-linux-gnu/libcu* /usr/lib/x86_64-linux-gnu/
COPY --from=builder /build/install-gpu/ $REDIS_MODULES/
COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts
# COPY --from=builder /usr/local/etc/redis/redis.conf /usr/local/etc/redis/
WORKDIR /data
EXPOSE 6379
# CMD ["/usr/local/bin/redis-server", "/usr/local/etc/redis/redis.conf", "--loadmodule", "/usr/lib/redis/modules/redisai.so"]
CMD ["/usr/local/bin/redis-server", "--loadmodule", "/usr/lib/redis/modules/redisai.so"]