Skip to content

Dockerize the CLI #421

@pilosoposerio

Description

@pilosoposerio

I recently needed to run the CLI inside containers (due to our CI platform). Not sure if there's an existing solution to run the CLI inside Docker because the CLI also spawn containers. What I've temporarily done is to just use docker:dind to accomplish this.

Dockerfile goes like this:

FROM golang:1.24-alpine3.21 AS install-dependabot

RUN go install github.com/dependabot/cli/cmd/dependabot@latest \
    && cp $GOPATH/bin/dependabot /usr/local/bin/

FROM docker:28-dind AS runtime
COPY --from=install-dependabot /usr/local/bin/dependabot /usr/local/bin/
ENTRYPOINT ["dependabot"]

Then build: docker build -t dependabot-cli:latest.

And run below to run update on local folder:

docker run \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $HOME/.docker/config.json:/root/.docker/config.json \
    -v $HOME/repos/repo:/repo \
    --network=host \
    -it \
    --rm \
    dependabot-cli update pip test/test --local /repo

If there's a better way, pls let me know. 🥺

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions