0
点赞
收藏
分享

微信扫一扫

portainer的二次开发之使用yarn管理前端环境

宁静的猫 2022-03-11 阅读 52

前端

需求

Docker
Node.js >= 6
yarn

构建
克隆代码:

$ git clone https://github.com/portainer/portainer.git
$ cd portainer

yarn解决依赖:
$ yarn

yarn启动:

$ yarn start

访问: http://localhost:9000

提醒

别忘了要 lint 代码:

$ yarn grunt lint

后端

假设不能解决网络问题,则去 releasesicon-default.png?t=M1L8https://github.com/portainer/portainer/releases 下载对应版本的 binary 依赖并解压存放到 Portainer 代码根目录的 dist/ 目录下,然后注释以下内容来跳过构建操作:

  • build/build_in_container.sh

    (略)
    #docker run --rm -tv "$(pwd)/api:/src" -e BUILD_GOOS="$1" -e BUILD_GOARCH="$2" portainer/golang-builder:cross-platform /src/cmd/portainer
    
    #mv "api/cmd/portainer/$binary" dist/
    (略)
  • build/download_docker_binary.sh
    #!/usr/bin/env bash
    exit 0
    (略)

然后再去执行前端操作即可。

不足
portainer 理应提供 golang 代码的依赖解决方案(dep, go.mod等)来保证构建环境的一致性(我尝试补充,但不清楚依赖的版本,未能解决)。

举报

相关推荐

0 条评论