Skip to content

Unable to build it with Dockerfile #15859

@viktor02

Description

@viktor02

What happened?

When running build with Docker, I got a error

~/g/gemini-cli (main)> podman build \
                                        --build-arg CLI_VERSION_ARG=1.0.0 \
                                        -t gemini .
STEP 1/14: FROM docker.io/library/node:20-slim
STEP 2/14: ARG SANDBOX_NAME="gemini-cli-sandbox"
--> Using cache 4a9c3df84b928baf0bb7efa2c30d1c44448b93377404433ce3cc54ac659e754c
--> 4a9c3df84b92
STEP 3/14: ARG CLI_VERSION_ARG
--> b1cab7354a19
STEP 4/14: ENV SANDBOX="$SANDBOX_NAME"
--> 14c012954864
STEP 5/14: ENV CLI_VERSION=$CLI_VERSION_ARG
--> 507b7a093157
STEP 6/14: RUN apt-get update && apt-get install -y --no-install-recommends   python3   make   g++   man-db   curl   dnsutils   less   jq   bc   gh   git   unzip   rsync   ripgrep   procps   psmisc   lsof   socat   ca-certificates   && apt-get clean   && rm -rf /var/lib/apt/lists/*
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
.....
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
--> 2f37ad19ae6d
STEP 7/14: RUN mkdir -p /usr/local/share/npm-global   && chown -R node:node /usr/local/share/npm-global
--> 9b4778435332
STEP 8/14: ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
--> 309d17b0dabd
STEP 9/14: ENV PATH=$PATH:/usr/local/share/npm-global/bin
--> 18f81dc80bef
STEP 10/14: USER node
--> 6c0dca14609e
STEP 11/14: COPY packages/cli/dist/google-gemini-cli-*.tgz /tmp/gemini-cli.tgz
Error: building at STEP "COPY packages/cli/dist/google-gemini-cli-*.tgz /tmp/gemini-cli.tgz": checking on sources under "/home/viktor/git/gemini-cli": Rel: can't make  relative to /home/viktor/git/gemini-cli; copier: stat: ["/packages/cli/dist/google-gemini-cli-*.tgz"]: no such file or directory

Looks like the current Dockerfile in the root of the repository assumes that the user has already installed Node.js dependencies and compiled the project artifacts (.tgz files) on their host machine before running docker/podman build.

If a user tries to build the container directly from a fresh clone (without having Node/NPM installed on their host), the build fails at the COPY step because the dist folders do not exist yet.

Steps to Reproduce

  • Clone the repository.
  • Ensure you have not run npm install or npm run build locally
  • Run: docker build -t gemini .

What did you expect to happen?

Build works from the box, from the clean system without nodejs

Client information

Client Information

Can't do it, because gemini not installed

Login information

No response

Anything else we need to know?

Its working after changing Dockerfile to multi-stage:

[2/2] STEP 14/14: CMD ["gemini"]
[2/2] COMMIT gemini
--> cfdf518a1685
Successfully tagged localhost/gemini:latest
cfdf518a168503301bd695734984ea7f25e50880adc6fc92b3b12c59245b2b9b
viktor@vpc ~/g/gemini-cli (main)> podman run --rm -it localhost/gemini:latest 
m
 ███            █████████  ██████████ ██████   ██████ █████ ██████   █████ █████
░░░███         ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
  ░░░███      ███     ░░░  ░███  █ ░  ░███░█████░███  ░███  ░███░███ ░███  ░███
    ░░░███   ░███          ░██████    ░███░░███ ░███  ░███  ░███░░███░███  ░███
     ███░    ░███    █████ ░███░░█    ░███ ░░░  ░███  ░███  ░███ ░░██████  ░███
   ███░      ░░███  ░░███  ░███ ░   █ ░███      ░███  ░███  ░███  ░░█████  ░███
 ███░         ░░█████████  ██████████ █████     █████ █████ █████  ░░█████ █████
░░░            ░░░░░░░░░  ░░░░░░░░░░ ░░░░░     ░░░░░ ░░░░░ ░░░░░    ░░░░░ ░░░░░

Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. Create GEMINI.md files to customize your interactions with Gemini.
4. /help for more information.

Metadata

Metadata

Assignees

Labels

area/platformIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions