DanielleNguyen commited on
Commit
f9ff95b
·
verified ·
1 Parent(s): 855f973

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -5
Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM debian:bookworm-slim
3
  WORKDIR /app
4
 
5
  RUN apt-get update && \
6
- apt-get install -y wget ca-certificates curl jq && \
7
  rm -rf /var/lib/apt/lists/*
8
 
9
  # Download latest CLI Proxy API for Linux
@@ -15,10 +15,32 @@ RUN LATEST_URL=$(curl -s https://api.github.com/repos/router-for-me/CLIProxyAPI/
15
  rm -rf cli-proxy-api.tar.gz CLIProxyAPI* && \
16
  chmod +x /app/cli-proxy-api
17
 
18
- # Copy config and auth files
19
- COPY config.yaml /app/config.yaml
20
- COPY auths /app/auths
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  EXPOSE 7860
23
 
24
- CMD ["./cli-proxy-api", "-config", "config.yaml"]
 
3
  WORKDIR /app
4
 
5
  RUN apt-get update && \
6
+ apt-get install -y wget ca-certificates curl jq gettext-base && \
7
  rm -rf /var/lib/apt/lists/*
8
 
9
  # Download latest CLI Proxy API for Linux
 
15
  rm -rf cli-proxy-api.tar.gz CLIProxyAPI* && \
16
  chmod +x /app/cli-proxy-api
17
 
18
+ # Copy config template
19
+ COPY config.yaml /app/config.template.yaml
20
+
21
+ # Create startup script
22
+ RUN echo '#!/bin/bash\n\
23
+ \n\
24
+ # Replace environment variables in config\n\
25
+ envsubst < /app/config.template.yaml > /app/config.yaml\n\
26
+ \n\
27
+ # Create auths directory\n\
28
+ mkdir -p /app/auths\n\
29
+ \n\
30
+ # Write auth JSON files from environment variables\n\
31
+ for i in $(seq 1 20); do\n\
32
+ var="AUTH_JSON_$i"\n\
33
+ name_var="AUTH_NAME_$i"\n\
34
+ if [ -n "${!var}" ]; then\n\
35
+ filename="${!name_var:-auth_$i.json}"\n\
36
+ echo "${!var}" > "/app/auths/$filename"\n\
37
+ echo "Created /app/auths/$filename"\n\
38
+ fi\n\
39
+ done\n\
40
+ \n\
41
+ exec ./cli-proxy-api -config config.yaml\n\
42
+ ' > /app/start.sh && chmod +x /app/start.sh
43
 
44
  EXPOSE 7860
45
 
46
+ CMD ["/app/start.sh"]