Spaces:
Sleeping
Sleeping
| # Build the navigator monitor server (GPT / Gemini live view) from source. | |
| FROM golang:1.22-bookworm AS monitor-build | |
| WORKDIR /src | |
| COPY monitor/ ./ | |
| RUN go mod tidy && CGO_ENABLED=0 go build -ldflags="-s -w" -o /monitor . | |
| # Build the profile-sync tool that snapshots the Chrome profile to Postgres (Neon). | |
| FROM golang:1.22-bookworm AS profilesync-build | |
| WORKDIR /src | |
| COPY profilesync/ ./ | |
| RUN go mod tidy && CGO_ENABLED=0 go build -ldflags="-s -w" -o /profilesync . | |
| # Build the ChatGPT API server (talks to gpt-extension on 127.0.0.1:9225). | |
| FROM golang:1.26-bookworm AS chatgpt-build | |
| WORKDIR /src | |
| COPY free-Chatgpt-api/ ./ | |
| RUN go mod download && CGO_ENABLED=0 go build -ldflags="-s -w" -o /agent . | |
| # Build the Gemini API server (talks to gemini-extension on 127.0.0.1:9226). | |
| FROM golang:1.26-bookworm AS gemini-build | |
| WORKDIR /src | |
| COPY free-gemini-api/ ./ | |
| RUN go mod download && CGO_ENABLED=0 go build -ldflags="-s -w" -o /free-gemini-api . | |
| FROM akashyadav758/chrome:latest | |
| USER root | |
| # Copy extensions into the container | |
| COPY free-Chatgpt-api/gpt-extension /opt/gpt-extension | |
| COPY free-gemini-api/gemini-extension /opt/gemini-extension | |
| # 3-tab monitor binary (replaces the single-view base monitor) | |
| COPY --from=monitor-build /monitor /opt/monitor3/monitor | |
| # Profile-sync binary (Chrome profile <-> Postgres snapshot) | |
| COPY --from=profilesync-build /profilesync /opt/profilesync/profilesync | |
| # Backend API servers (run on localhost; the monitor gateway fronts them). | |
| COPY --from=chatgpt-build /agent /opt/chatgpt/agent | |
| COPY free-Chatgpt-api/config.json /opt/chatgpt/config.json | |
| COPY --from=gemini-build /free-gemini-api /opt/gemini-srv/free-gemini-api | |
| # Install Chrome for Testing (unbranded). Branded google-chrome-stable (>=128) | |
| # silently ignores --load-extension, so unpacked extensions never load. CfT is the | |
| # unbranded build of the same Chrome version where --load-extension still works. | |
| ARG CFT_URL=https://storage.googleapis.com/chrome-for-testing-public/145.0.7632.117/linux64/chrome-linux64.zip | |
| RUN apt-get update && apt-get install -y --no-install-recommends unzip && \ | |
| curl -fsSL "$CFT_URL" -o /tmp/cft.zip && \ | |
| unzip -q /tmp/cft.zip -d /opt && \ | |
| rm -f /tmp/cft.zip && \ | |
| apt-get purge -y unzip && apt-get autoremove -y && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Set correct permissions and ownership | |
| RUN chown -R 1000:1000 /opt/gpt-extension /opt/gemini-extension /opt/chrome-linux64 /opt/monitor3 /opt/profilesync /opt/chatgpt /opt/gemini-srv && \ | |
| chmod -R 755 /opt/gpt-extension /opt/gemini-extension /opt/chrome-linux64 /opt/monitor3 /opt/profilesync /opt/chatgpt /opt/gemini-srv | |
| # Replace the start script with the non-root version | |
| COPY --chmod=755 start_hf.sh /start.sh | |
| # Run as non-root user 1000 | |
| USER 1000 | |
| CMD ["/start.sh"] | |