File size: 1,593 Bytes
428a54b
 
 
 
 
e4d265f
428a54b
 
 
 
 
 
 
 
 
 
 
f9ff95b
 
 
e4d265f
 
 
 
f9ff95b
 
 
 
 
 
 
 
 
e4d265f
 
d817b4f
e4d265f
 
 
 
 
f9ff95b
 
 
428a54b
 
 
f9ff95b
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
FROM debian:bookworm-slim

WORKDIR /app

RUN apt-get update && \
    apt-get install -y wget ca-certificates curl jq gettext-base inotify-tools && \
    rm -rf /var/lib/apt/lists/*

# Download latest CLI Proxy API for Linux
RUN LATEST_URL=$(curl -s https://api.github.com/repos/router-for-me/CLIProxyAPI/releases/latest | jq -r '.assets[] | select(.name | test("linux.*amd64.*tar.gz")) | .browser_download_url') && \
    echo "Downloading: $LATEST_URL" && \
    wget -q "$LATEST_URL" -O cli-proxy-api.tar.gz && \
    tar -xzf cli-proxy-api.tar.gz && \
    find . -name "cli-proxy-api" -type f -exec mv {} /app/cli-proxy-api \; && \
    rm -rf cli-proxy-api.tar.gz CLIProxyAPI* && \
    chmod +x /app/cli-proxy-api

# Copy config template
COPY config.yaml /app/config.template.yaml

# Create Supabase sync script
COPY supabase-sync.sh /app/supabase-sync.sh
RUN chmod +x /app/supabase-sync.sh

# Create startup script
RUN echo '#!/bin/bash\n\
\n\
# Replace environment variables in config\n\
envsubst < /app/config.template.yaml > /app/config.yaml\n\
\n\
# Create auths directory\n\
mkdir -p /app/auths\n\
\n\
# Download auth files from Supabase Storage\n\
echo "=== Downloading auth files from Supabase ==="\n\
/app/supabase-sync.sh download || echo "Supabase download skipped"\n\
\n\
echo "=== Auth files loaded: $(find /app/auths -name "*.json" | wc -l) ==="\n\
\n\
# Start file watcher in background (sync changes to Supabase)\n\
/app/supabase-sync.sh watch &\n\
\n\
exec ./cli-proxy-api -config config.yaml\n\
' > /app/start.sh && chmod +x /app/start.sh

EXPOSE 7860

CMD ["/app/start.sh"]