Skip to content

Commit eac574c

Browse files
authored
new docker system (#783)
1 parent d3d4501 commit eac574c

File tree

11 files changed

+179
-283
lines changed

11 files changed

+179
-283
lines changed

.circleci/config.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,12 @@ commands:
174174
- abort_for_docs
175175
- abort_for_noci
176176
- checkout-all
177-
- run:
178-
name: Relocate docker overlay2 dir
179-
command: |
180-
sudo systemctl stop docker
181-
sudo mkdir -p /var2/lib/docker
182-
sudo mv /var/lib/docker/overlay2 /var2/lib/docker
183-
sudo mkdir /var/lib/docker/overlay2
184-
sudo mount --bind /var2/lib/docker/overlay2 /var/lib/docker/overlay2
185-
sudo systemctl start docker
177+
- relocate-docker-storage
186178
- run:
187179
name: Build
188180
command: |
189-
docker build -f Dockerfile.gpu-test --no-cache -t redisai-gpu:latest-x64-bionic-test .
181+
pushd opt/build/docker
182+
make DOCKER_SUFFIX=".gpu-test" DOCKER_ARGS="-s dockerfile-gpu-test.tmpl" DOCKER_OPTS=--no-cache DEFAULT_TAG="redisai-gpu:latest-test"
190183
- run:
191184
name: Test
192185
command: |
@@ -196,7 +189,6 @@ commands:
196189
- store_artifacts:
197190
path: /home/circleci/tests
198191

199-
200192
jobs:
201193
lint:
202194
docker:
@@ -235,13 +227,15 @@ jobs:
235227
- setup_remote_docker
236228
- checkout-all
237229
- setup-automation
230+
231+
# since we run in parallel, we need to generate docker files with different suffixes hence the DOCKER_SUFFIX
238232
- run:
239233
name: Build for platform
240234
command: |
241235
bash <(curl -fsSL https://get.docker.com)
242236
pushd opt/build/docker
243237
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
244-
make build <<parameters.target>> OSNICK=<<parameters.osnick>> ARTIFACTS=1 VERBOSE=1 <<parameters.lite>>
238+
make build DOCKER_SUFFIX="$$" <<parameters.target>> OSNICK=<<parameters.osnick>> PACK=1 VERBOSE=1 <<parameters.lite>>
245239
popd > /dev/null
246240
logstar=bin/artifacts/tests-logs-cpu.tgz
247241
logsdir=tests/logs/cpu
@@ -574,7 +568,7 @@ workflows:
574568
- xenial
575569
- bionic
576570
lite:
577-
- "REDISAI_LITE=0 publish PUSH_GENERAL=1 OFFICIAL=1"
571+
- "REDISAI_LITE=0 PUBLISH=1"
578572
- "REDISAI_LITE=1"
579573
target:
580574
- "CPU=1"

Dockerfile

Lines changed: 0 additions & 88 deletions
This file was deleted.

Dockerfile.gpu

Lines changed: 0 additions & 95 deletions
This file was deleted.

docs/developer.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,15 @@ You can compile and build the module from its source code - refer to the [Buildi
113113

114114
**Building in a docker (x86_64)**
115115

116-
The RedisAI source code can be mounted in a docker, and built there, but edited from the external operating system. This assumes that you are running a modern version of docker, and that you are making a recursive clone of this repository and all of its submodules.
116+
The RedisAI source code can be mounted in a docker, and built there, but edited from the external operating system. This assumes that you are running a modern version of docker, and that you are making a recursive clone of this repository and all of its submodules. This assumes that you have jinja installed, as the docker files are geneated from the dockerfile.tmpl in the *opt/build/docker* directory.
117117

118118
```
119119
git clone --recursive https://github.com/RedisAI/RedisAI
120-
cd RedisAI
121-
docker build -t redisai:latest -f Dockerfile --build-arg OSNICK=bionic OS=ubuntu:18.04 .
120+
cd RedisAI/opt/build/docker
121+
make
122+
123+
# note, to build with GPU support instead
124+
make GPU=1
122125
```
123126

124127
After this, you can run the create docker and mount your source code with the following command, from within the RedisAI folder.

opt/build/docker/Makefile

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,68 @@
1+
# Feel free to change these
2+
PRODUCT=redisai
3+
DOCKER_ORG=redislabs
4+
REDIS_VERSION=6.2.4
5+
REDIS_CUDA_VERSION=11.0-cudnn8
6+
REDISAI_LITE=0
17

2-
ROOT=../../..
3-
MK.pyver:=3
4-
include $(ROOT)/opt/readies/mk/main
5-
6-
# OSNICK=buster|stretch|bionic|xenial|centos7
7-
OSNICK ?= buster
8-
9-
REPO=redisai
10-
11-
# LATEST_BRANCH=1.2
12-
INT_BRANCHES=1.2
13-
14-
REDIS_VER:=6.2.4
15-
REDISAI_LITE:=0
8+
PACK=1 # to fetch the artifacts
169

17-
export ART_DIR=$(ROOT)/bin/artifacts
18-
export ART_INT_DIR=/var/opt/redislabs/artifacts
10+
DOCKER_OPTS= # set, to pass custom options to docker, but remember to quote them
11+
OSNICK ?= bionic
1912

20-
DOCKER_BUILD_ARGS=\
21-
REDISAI_LITE=$(REDISAI_LITE)
13+
# set to pass multiple directories as docker sources to include in templates
14+
DOCKER_SOURCES=""
2215

23-
#----------------------------------------------------------------------------------------------
16+
# set, to generate a file named Dockerfile<suffix>, i.e useful when you want to run things in parallel
17+
DOCKER_SUFFIX=
2418

25-
ifeq ($(CPU),1)
26-
VARIANT=cpu
19+
# Add space delimited docker tags, and they'll all be applied
20+
DOCKER_TAGS=
2721

28-
else ifeq ($(GPU),1)
29-
VARIANT=gpu
30-
DOCKERFILE_STEM ?= $(ROOT)/Dockerfile.gpu
22+
DEFAULT_TAG=${DOCKER_ORG}/${PRODUCT}:${VERSION}-cpu-${OSNICK}
3123

32-
OS.custom:=1
33-
34-
OS.centos7=centos7
35-
OS.bionic=ubuntu18.04
36-
OS.xenial=ubuntu16.04
37-
38-
else ifeq ($(JETSON),1)
39-
VARIANT=jetson
40-
DOCKERFILE_STEM ?= $(ROOT)/Dockerfile.jetson
24+
# set gpu arguments
25+
ifeq ($(GPU),1)
26+
DOCKER_ARGS = gpu_build=1
27+
DOCKER_SUFFIX=gpu
28+
DEFAULT_TAG=${DOCKER_ORG}/${PRODUCT}:${VERSION}-gpu-${OSNICK}
29+
endif
4130

31+
# remap ubuntu versions because of nvidia cuda
32+
ifeq ($(OSNICK),xenial)
33+
REDIS_CUDA_UBUNTUVERSION=16.04
34+
endif
35+
ifeq ($(OSNICK),bionic)
36+
REDIS_CUDA_UBUNTUVERSION=18.04
4237
endif
4338

44-
#----------------------------------------------------------------------------------------------
39+
DOCKERWRAPPER_EXTRA_VARS=\
40+
REDISAI_LITE=${REDISAI_LITE} \
41+
REDIS_CUDA_VERSION=${REDIS_CUDA_VERSION} \
42+
REDIS_CUDA_UBUNTUVERSION=${REDIS_CUDA_UBUNTUVERSION}
4543

46-
include $(MK)/docker.native
44+
### Defaults ###
45+
ROOT=../../..
46+
READIES=${ROOT}/opt/readies
47+
48+
#------------------------------------------------------------------------------
49+
define HELP
50+
make build # build and optionally publish the docker, from a template file
51+
OSNICK=<> # base operating system
52+
REDISAI_LITE=1 # enable RedisAI lite builds
53+
DOCKER_SUFFIX=<> # optional suffix for the generated dockerfile
54+
DOCKER_ARGS=FOO=BAR # key-value pairs of variables to pass into the docker build
55+
PACK=1 # fetch generated artifacts
56+
DOCKER_TAGS=a,b,c # tags to append and push to dockerhub
57+
DEFAULT_TAG=redislabs/redisai # default docker tag to build, and push
58+
TEST=1 # run tests, if specified
59+
VERSION=x.y.z # set the docker version
60+
NOP=1 # set to echo files in docker generation, and not run
61+
DOCKER_SOURCES=/a/path # append paths to the template generator
62+
PUBLISH=1 # if set, push to dockerhub (requires docker login)
63+
DOCKER_OPTS=XXX # Options to pass to the docker build command
64+
endef
65+
#------------------------------------------------------------------------------
66+
67+
# rules, for building
68+
include ${READIES}/mk/docker.rules

0 commit comments

Comments
 (0)