在 Gitee 或 GitCode 上克隆 Dify 项目源码并启动 Docker 环境

在 Gitee 或 GitCode 上克隆 Dify 项目源码并启动 Docker 环境

第一步:克隆源码仓库

首先,使用以下命令将项目克隆到本地,确保您已经在 Gitee 或 GitCode 上配置了 SSH 密钥:

# 每天(2点同步github上最新代码)
git clone https://gitcode.com/Mingcai_Xiong/dify-copy-github.git


完成克隆后,进入项目目录:

cd ~/dify-copy-github/docker

查看依赖镜像列表

grep 'image:' docker-compose.yaml | awk '{print $2}' | sort -u

第二步:下载 Dify 所需的 Docker 镜像

在拉取镜像之前,建议您配置 Docker 的镜像加速,以加快下载速度。打开或创建 /etc/docker/daemon.json 文件,添加如下内容:

{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://ueo0uggy.mirror.aliyuncs.com",
    "https://docker.m.daocloud.io",
    "https://cf-workers-docker-io-apl.pages.dev",
    "http://95.169.25.181"
  ]
}

保存后,重启 Docker 服务:

sudo systemctl restart docker

接下来,您可以使用以下命令查看 docker-compose.yaml 中需要拉取的镜像:

cat docker-compose.yaml | grep 'image:'

输出示例:

image: langgenius/dify-web:0.10.0
image: postgres:15-alpine
image: redis:6-alpine
image: langgenius/dify-sandbox:0.2.10
image: ubuntu/squid:latest
image: certbot/certbot
image: nginx:latest
image: semitechnologies/weaviate:1.19.0
image: langgenius/qdrant:v1.7.3
......

现在,您可以拉取所有这些镜像:

sudo docker compose pull

第三步:启动项目

  1. 复制环境配置文件:
cp .env.example .env
  1. 启动 Docker 容器:
docker compose up -d

此命令将在后台启动所有定义的服务。如果您只想构建特定服务(如 nginx),且不想重新构建其依赖项,可以使用以下命令:

docker compose up -d --build --no-deps nginx
参数解释
  • --build:强制重新构建镜像,即使镜像已经存在。
  • --no-deps:不启动此服务的依赖项,仅启动指定的服务。

总结

通过上述步骤,您已经成功地克隆了 Dify 的源码、配置了 Docker 镜像加速、拉取了所需的镜像并启动了项目。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值