有没有预装GitHub CLI的Docker镜像?

3

我找不到任何预装 gh 工具(git hub 客户端)的 Docker 镜像。你知道有没有这样的镜像吗?


你可以创建一个 :) - vodolaz095
你尝试过这个 GH 问题中的 Dockerfile 吗?https://github.com/cli/cli/issues/658#issuecomment-701375745 - Nick ODell
3个回答

12

最终,我按照官方安装文档的步骤,在Ubuntu上构建了自己的映像,因为提供的选项都没有起作用:

FROM ubuntu:latest
RUN apt update && apt install -y \
  curl \
  gpg
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg;
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null;
RUN apt update && apt install -y gh;

1

-4

是的。例如,基于alpine的这个:https://hub.docker.com/r/alpine/git。 但是更容易的方法是创建自己的镜像或容器,并在构建时添加git。 以下是一个简单的Dockerfile示例:

FROM nginx:latest

EXPOSE 3000
RUN apt-get update && apt-get install -y git-all
ENTRYPOINT ["tail", "-f", "/dev/null"]

编辑:显然在这种情况下应该是“apt-get install -y git-all”而不是“apt-get install -y git”。我的错。


我认为OP是在询问关于github工具的问题,而非git。https://github.com/cli/cli - Hans Kilian
嗨 @GabeRAMturn,这是 git 命令而不是 GitHub cli (gh)。 - dhalfageme
是的,那就是 @Hans Kilian - dhalfageme
@GabeRAMturn 你确定 git-all 安装了 gh 客户端吗? - dhalfageme

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接