Home > Net >  Is there a docker image with GitHub CLI Preinstalled?
Is there a docker image with GitHub CLI Preinstalled?

Time:10-07

I can't find any docker image with gh tools (git hub client) preinstalled. Do yo know anyone?

CodePudding user response:

yes. This one for example based on alpine: https://hub.docker.com/r/alpine/git but it's a lot easier to create your own image or container and simply add git on build. Here's an easy example Dockerfile to do that:

FROM nginx:latest

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

Edit: obviously it should be "apt-get install -y git-all" instead of "apt-get install -y git" in that case. my bad.

CodePudding user response:

Finally I built my own image following the official docs for installation in ubuntu, since neither of the options provided worked:

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;
  • Related