我们的 Representer 以 Docker 镜像的形式部署。
请阅读工具 Docker 通用信息,熟悉它们的工作方式。
当我们运行 Representer 为提交的解答生成 representation 时,执行的 Docker 命令如下:
docker run \
--rm \
--network none \
--mount type=bind,src="${solution_dir}",dst=/solution \
--mount type=bind,src="${output_dir}",dst=/output \
--tmpfs /tmp:rw \
"exercism/${track_slug}-representer" \
"${exercise_slug}" "/solution" "/output"
可以看到,我们向 Docker 镜像传入了 3 个实参:
我们所有的 Representer 在实现中都遵循以下约定:
Dockerfile位于代码仓库的根目录。/opt/representer。/opt/representer/bin/run.sh
/opt/representer/bin/run.sh脚本接受 3 个实参:
更多信息请参见接口。
新建的 representer 代码仓库默认会使用这些约定。