服务器搭建cvat

1.安装docker

sudo apt-get update
sudo apt-get --no-install-recommends install -y \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg-agent \
  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt-get update
sudo apt-get --no-install-recommends install -y docker-ce docker-ce-cli containerd.io

2.获取权限

sudo groupadd docker
sudo usermod -aG docker $USER

3.获取权限

sudo apt-get --no-install-recommends install -y python3-pip python3-setuptools
sudo python3 -m pip install setuptools docker-compose

4.克隆cvat代码

sudo apt-get --no-install-recommends install -y git
git clone https://gitee.com/luohenyueji/cvat
cd cvat

5.打开上一步下载的源代码目录cvat/Dockerfile文件,找到Install requirements这项,然后修改并添加相应的python镜像,镜像可更换其他

#RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
RUN DATUMARO_HEADLESS=1 python3 -m pip install -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt -i https://mirrors.aliyun.com/pypi/simple/

6.构建docker镜像

sudo docker-compose build

如果用的wsl2的话换成

sudo service docker start

7.运行docker容器

docker-compose up -d

8.创建管理员用户

sudo docker exec -it cvat_server bash -ic 'python3 ~/manage.py createsuperuser'

9.关闭docker容器

docker-compose down

10.搭载服务器上

cd cvat
cp docker-compose.yml  docker-compose.override.yml
sudo vim docker-compose.override.yml

将内容改成


services:
  cvat:
    labels:
      - traefik.http.routers.cvat.rule=Host(`${CVAT_HOST:-外网ip}`) && 
          PathPrefix(`/api/`, `/git/`, `/opencv/`, `/analytics/`, `/static/`, `/admin`, `/documentation/`, `/django-rq`)
  cvat_ui:
    labels:
      - traefik.http.routers.cvat-ui.rule=Host(`${CVAT_HOST:-外网ip}`)
  traefik:
    ports:
      - 8080:8080 # 修改端口
      - 8090:8090

然后

docker-compose -f docker-compose.yml  -f docker-compose.override.yml up -d

就好了

你可能感兴趣的:(服务器,服务器,django,python,docker)