Skip to content

Commit b51c8e8

Browse files
nmanovicChris Lee-Messer
authored and
Chris Lee-Messer
committed
Cleanup Dockerfiles for CVAT (cvat-ai#1060)
* Replaced wget by curl * Moved CI stuff into Dockerfile.ci * Use docker-compose to run commnands inside docker (need environment variables) * Added patool again (to support different archive formats) * Roll back tensorflow version: 1.15 -> 1.13.1 Fixed cvat-ai#982 Fixed cvat-ai#1017 * datumaro install tensorflow 2.x now. It breaks automatic annotation using TF. * Follow redirects in curl (auto_segmentation)
1 parent fde944b commit b51c8e8

File tree

15 files changed

+84
-81
lines changed

15 files changed

+84
-81
lines changed

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ services:
99
- docker
1010

1111
before_script:
12-
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml up --build -d
12+
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
1313

1414
script:
15-
- docker exec -it cvat /bin/bash -c 'python3 manage.py test cvat/apps utils/cli'
16-
- docker exec -it cvat /bin/bash -c 'python3 manage.py test datumaro/'
17-
- docker exec -it cvat /bin/bash -c 'cd cvat-core && npm install && npm run test && npm run coveralls'
15+
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test cvat/apps utils/cli'
16+
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test datumaro/'
17+
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-core && npm install && npm run test && npm run coveralls'

CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ to changes in ``.env/bin/activate`` file are active.
9191
- Perform all steps in the automatic annotation section
9292
- Download ReID model and save it somewhere:
9393
```sh
94-
wget https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.xml -O reid.xml
95-
wget https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.bin -O reid.bin
94+
curl https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.xml -o reid.xml
95+
curl https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.bin -o reid.bin
9696
```
9797
- Add next line to ``.env/bin/activate``:
9898
```sh
@@ -103,7 +103,7 @@ to changes in ``.env/bin/activate`` file are active.
103103
- Perform all steps in the automatic annotation section
104104
- Download Deep Extreme Cut model, unpack it, and save somewhere:
105105
```sh
106-
wget https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip -O dextr.zip
106+
curl https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip -o dextr.zip
107107
unzip dextr.zip
108108
```
109109
- Add next lines to ``.env/bin/activate``:
@@ -115,7 +115,7 @@ unzip dextr.zip
115115
### Tensorflow RCNN
116116
- Download RCNN model, unpack it, and save it somewhere:
117117
```sh
118-
wget -O model.tar.gz http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz && \
118+
curl http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz -o model.tar.gz && \
119119
tar -xzf model.tar.gz
120120
```
121121
- Add next lines to ``.env/bin/activate``:
@@ -127,7 +127,7 @@ tar -xzf model.tar.gz
127127
### Tensorflow Mask RCNN
128128
- Download Mask RCNN model, and save it somewhere:
129129
```sh
130-
wget https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5
130+
curl https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5 -o mask_rcnn_coco.h5
131131
```
132132
- Add next lines to ``.env/bin/activate``:
133133
```sh

Dockerfile

+17-54
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ ENV DJANGO_CONFIGURATION=${DJANGO_CONFIGURATION}
2222
# Install necessary apt packages
2323
RUN apt-get update && \
2424
apt-get install -yq \
25-
python-software-properties \
26-
software-properties-common \
27-
wget && \
25+
software-properties-common && \
2826
add-apt-repository ppa:mc3man/xerus-media -y && \
2927
add-apt-repository ppa:mc3man/gstffmpeg-keep -y && \
3028
apt-get update && \
@@ -40,14 +38,19 @@ RUN apt-get update && \
4038
python3-dev \
4139
python3-pip \
4240
tzdata \
43-
unzip \
44-
unrar \
4541
p7zip-full \
46-
git-core \
47-
libsm6 \
48-
libxext6 && \
49-
python3 -m pip install -U pip && \
50-
python3 -m pip install -U setuptools && \
42+
git \
43+
ssh \
44+
poppler-utils \
45+
curl && \
46+
curl https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
47+
apt-get install -y git-lfs && git lfs install && \
48+
if [ -z ${socks_proxy} ]; then \
49+
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30\"" >> ${HOME}/.bashrc; \
50+
else \
51+
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30 -o ProxyCommand='nc -X 5 -x ${socks_proxy} %h %p'\"" >> ${HOME}/.bashrc; \
52+
fi && \
53+
python3 -m pip install --no-cache-dir -U pip setuptools && \
5154
ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
5255
dpkg-reconfigure -f noninteractive tzdata && \
5356
add-apt-repository --remove ppa:mc3man/gstffmpeg-keep -y && \
@@ -69,8 +72,8 @@ ENV REID_MODEL_DIR=${HOME}/reid
6972
RUN if [ "$OPENVINO_TOOLKIT" = "yes" ]; then \
7073
/tmp/components/openvino/install.sh && \
7174
mkdir ${REID_MODEL_DIR} && \
72-
wget https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.xml -O reid/reid.xml && \
73-
wget https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.bin -O reid/reid.bin; \
75+
curl https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.xml -o reid/reid.xml && \
76+
curl https://download.01.org/openvinotoolkit/2018_R5/open_model_zoo/person-reidentification-retail-0079/FP32/person-reidentification-retail-0079.bin -o reid/reid.bin; \
7477
fi
7578

7679
# Tensorflow annotation support
@@ -89,53 +92,13 @@ RUN if [ "$AUTO_SEGMENTATION" = "yes" ]; then \
8992
bash -i /tmp/components/auto_segmentation/install.sh; \
9093
fi
9194

92-
ARG WITH_TESTS
93-
RUN if [ "$WITH_TESTS" = "yes" ]; then \
94-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
95-
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \
96-
wget -qO- https://deb.nodesource.com/setup_9.x | bash - && \
97-
apt-get update && \
98-
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
99-
google-chrome-stable \
100-
nodejs && \
101-
rm -rf /var/lib/apt/lists/*; \
102-
mkdir tests && cd tests && npm install \
103-
eslint \
104-
eslint-detailed-reporter \
105-
karma \
106-
karma-chrome-launcher \
107-
karma-coveralls \
108-
karma-coverage \
109-
karma-junit-reporter \
110-
karma-qunit \
111-
qunit; \
112-
echo "export PATH=~/tests/node_modules/.bin:${PATH}" >> ~/.bashrc; \
113-
fi
114-
11595
# Install and initialize CVAT, copy all necessary files
11696
COPY cvat/requirements/ /tmp/requirements/
11797
COPY supervisord.conf mod_wsgi.conf wait-for-it.sh manage.py ${HOME}/
11898
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
11999
# pycocotools package is impossible to install with its dependencies by one pip install command
120100
RUN python3 -m pip install --no-cache-dir pycocotools==2.0.0
121101

122-
# Install git application dependencies
123-
RUN apt-get update && \
124-
apt-get install -y ssh netcat-openbsd git curl zip && \
125-
wget -qO /dev/stdout https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
126-
apt-get install -y git-lfs && \
127-
git lfs install && \
128-
rm -rf /var/lib/apt/lists/* && \
129-
if [ -z ${socks_proxy} ]; then \
130-
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30\"" >> ${HOME}/.bashrc; \
131-
else \
132-
echo export "GIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=no -o ConnectTimeout=30 -o ProxyCommand='nc -X 5 -x ${socks_proxy} %h %p'\"" >> ${HOME}/.bashrc; \
133-
fi
134-
135-
# Install poppler for working with pdfs
136-
RUN apt-get update && \
137-
apt install -y poppler-utils && \
138-
rm -rf /var/lib/apt/lists/*
139102

140103
# CUDA support
141104
ARG CUDA_SUPPORT
@@ -150,8 +113,8 @@ ENV WITH_DEXTR=${WITH_DEXTR}
150113
ENV DEXTR_MODEL_DIR=${HOME}/dextr
151114
RUN if [ "$WITH_DEXTR" = "yes" ]; then \
152115
mkdir ${DEXTR_MODEL_DIR} -p && \
153-
wget https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip -O ${DEXTR_MODEL_DIR}/dextr.zip && \
154-
unzip ${DEXTR_MODEL_DIR}/dextr.zip -d ${DEXTR_MODEL_DIR} && rm ${DEXTR_MODEL_DIR}/dextr.zip; \
116+
curl https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip -o ${DEXTR_MODEL_DIR}/dextr.zip && \
117+
7z e ${DEXTR_MODEL_DIR}/dextr.zip -o${DEXTR_MODEL_DIR} && rm ${DEXTR_MODEL_DIR}/dextr.zip; \
155118
fi
156119

157120
COPY ssh ${HOME}/.ssh

Dockerfile.ci

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM cvat
2+
3+
ENV DJANGO_CONFIGURATION=testing
4+
USER root
5+
6+
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
7+
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \
8+
curl https://deb.nodesource.com/setup_9.x | bash - && \
9+
apt-get update && \
10+
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
11+
google-chrome-stable \
12+
nodejs && \
13+
rm -rf /var/lib/apt/lists/*;
14+
15+
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
16+
17+
# RUN all commands below as 'django' user
18+
USER ${USER}
19+
20+
RUN mkdir -p tests && cd tests && npm install \
21+
eslint \
22+
eslint-detailed-reporter \
23+
karma \
24+
karma-chrome-launcher \
25+
karma-coveralls \
26+
karma-coverage \
27+
karma-junit-reporter \
28+
karma-qunit \
29+
qunit; \
30+
echo "export PATH=~/tests/node_modules/.bin:${PATH}" >> ~/.bashrc;
31+
32+
ENTRYPOINT []

components/auto_segmentation/install.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
set -e
55

6+
MASK_RCNN_URL=https://github.com/matterport/Mask_RCNN
7+
68
cd ${HOME} && \
7-
git clone https://github.com/matterport/Mask_RCNN.git && \
8-
wget https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5 && \
9-
mv mask_rcnn_coco.h5 Mask_RCNN/mask_rcnn_coco.h5
9+
git clone ${MASK_RCNN_URL}.git && \
10+
curl -L ${MASK_RCNN_URL}/releases/download/v2.0/mask_rcnn_coco.h5 -o Mask_RCNN/mask_rcnn_coco.h5
1011

1112
# TODO remove useless files
1213
# tensorflow and Keras are installed globally

components/cuda/install.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ apt-get update && apt-get install -y --no-install-recommends --allow-unauthentic
3030
libnccl2=$NCCL_VERSION-1+cuda9.0 \
3131
libcudnn7=$CUDNN_VERSION-1+cuda9.0 && \
3232
ln -s cuda-9.0 /usr/local/cuda && \
33-
rm -rf /var/lib/apt/lists/* \
33+
rm -rf /var/lib/apt/lists/* \
3434
/etc/apt/sources.list.d/nvidia-ml.list /etc/apt/sources.list.d/cuda.list
3535

3636
python3 -m pip uninstall -y tensorflow
37-
python3 -m pip install --no-cache-dir tensorflow-gpu==1.15.0
37+
python3 -m pip install --no-cache-dir tensorflow-gpu==1.13.1

components/tf_annotation/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -e
88

99
cd ${HOME} && \
10-
wget -O model.tar.gz http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz && \
10+
curl http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz -o model.tar.gz && \
1111
tar -xzf model.tar.gz && rm model.tar.gz && \
1212
mv faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28 ${HOME}/rcnn && cd ${HOME} && \
1313
mv rcnn/frozen_inference_graph.pb rcnn/inference_graph.pb

cvat/apps/documentation/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ server. Proxy is an advanced topic and it is not covered by the guide.
100100
install it as well. Type commands below in a terminal window:
101101

102102
```sh
103-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
103+
curl https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
104104
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
105105
sudo apt-get update
106106
sudo apt-get install -y google-chrome-stable

cvat/requirements/base.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ django-rest-auth[with_social]==0.9.5
3939
cython==0.29.13
4040
matplotlib==3.0.3
4141
scikit-image==0.15.0
42-
tensorflow==1.15.0
42+
tensorflow==1.13.1
4343
keras==2.2.5
4444
opencv-python==4.1.0.25
4545
h5py==2.9.0
4646
imgaug==0.2.9
4747
django-cors-headers==3.2.0
4848
furl==2.0.0
49+
# The package is used by pyunpack as a command line tool to support multiple
50+
# archives. Don't use as a python module because it has GPL license.
51+
patool==1.12

cvat/requirements/testing.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
-r development.txt
2-
fakeredis==1.0.3
2+
fakeredis==1.1.0
3+
# Fix dependencies for fakeredis 1.1.0
4+
# Pip will not reinstall six package if it is installed already
5+
six==1.12.0

datumaro/datumaro/util/image.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
try:
1515
import cv2
1616
_IMAGE_BACKEND = _IMAGE_BACKENDS.cv2
17-
except ModuleNotFoundError:
17+
except ImportError:
1818
import PIL
1919
_IMAGE_BACKEND = _IMAGE_BACKENDS.PIL
2020

datumaro/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ Cython>=0.27.3 # include before pycocotools
22
GitPython>=2.1.11
33
lxml>=4.4.1
44
matplotlib<3.1 # 3.1+ requires python3.6, but we have 3.5 in cvat
5-
opencv-python>=4.1.0.25
5+
opencv-python-headless>=4.1.0.25
66
Pillow>=6.1.0
77
pycocotools>=2.0.0
88
PyYAML>=5.1.1
99
scikit-image>=0.15.0
1010
tensorboardX>=1.8
11-
tensorflow>=1.12.0
11+
tensorflow==1.13.1

docker-compose.ci.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
version: "2.3"
22

33
services:
4-
cvat:
4+
cvat_ci:
5+
image: cvat_ci
56
build:
6-
args:
7-
DJANGO_CONFIGURATION: "testing"
8-
WITH_TESTS: "yes"
97
network: host
8+
context: .
9+
dockerfile: Dockerfile.ci
10+
depends_on:
11+
- cvat
1012
environment:
1113
COVERALLS_REPO_TOKEN:
1214
TRAVIS:

docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ services:
4949
AUTO_SEGMENTATION: "no"
5050
USER: "django"
5151
DJANGO_CONFIGURATION: "production"
52-
WITH_TESTS: "no"
5352
TZ: "Etc/UTC"
5453
OPENVINO_TOOLKIT: "no"
5554
environment:

utils/tfrecords/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
argparse==1.1
2-
tensorflow==1.15.0
2+
tensorflow==1.13.1
33
pathlib==1.0.1

0 commit comments

Comments
 (0)