File size: 2,784 Bytes
23a7459
c6e6dac
 
 
 
 
69c2cb9
 
 
 
 
 
3666689
 
 
5c7f4b5
3666689
 
 
 
 
 
 
 
2a601f2
 
 
 
6ada2bc
5c7f4b5
4216716
6ada2bc
c6e6dac
 
 
69c2cb9
 
 
3666689
 
5c7f4b5
3666689
 
8bb42ac
 
 
 
 
 
 
 
 
 
 
dc356d0
23a7459
 
6ada2bc
2a601f2
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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"]