Final Stack: Go Proxy on 7860
Browse files- Dockerfile +19 -18
Dockerfile
CHANGED
|
@@ -5,18 +5,18 @@ COPY . .
|
|
| 5 |
RUN go mod download
|
| 6 |
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/cliproxy ./cmd/server/
|
| 7 |
|
| 8 |
-
# 2. Runtime
|
| 9 |
-
FROM
|
| 10 |
|
| 11 |
USER root
|
| 12 |
|
| 13 |
-
# Install dependencies for
|
| 14 |
-
RUN
|
| 15 |
-
apt-get update && apt-get install -y python3-pip curl procps && rm -rf /var/lib/apt/lists/*; \
|
| 16 |
-
fi
|
| 17 |
|
| 18 |
-
# Copy
|
| 19 |
COPY --from=builder /app/cliproxy /usr/local/bin/cliproxy
|
|
|
|
|
|
|
| 20 |
COPY config.yaml /etc/cliproxy/config.yaml
|
| 21 |
COPY static /etc/cliproxy/static
|
| 22 |
|
|
@@ -25,27 +25,28 @@ COPY freeapis-proxy /app/freeapis-proxy
|
|
| 25 |
WORKDIR /app/freeapis-proxy
|
| 26 |
RUN pip3 install --break-system-packages -r requirements.txt || pip3 install -r requirements.txt
|
| 27 |
|
| 28 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
ENV MANAGEMENT_STATIC_PATH=/etc/cliproxy/static
|
| 30 |
|
| 31 |
WORKDIR /app
|
| 32 |
RUN mkdir -p /app/auth && chmod 777 /app/auth
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
# 1. Fix config to use localhost
|
| 36 |
-
# 2. Start FreeAPIs Proxy (Background, Port 5001)
|
| 37 |
-
# 3. Start Puter (Background, Port 8081 - Internal)
|
| 38 |
-
# 4. Start Go Proxy (Foreground, Port 7860 - Public)
|
| 39 |
RUN echo "#!/bin/bash" > /start.sh && \
|
|
|
|
|
|
|
| 40 |
echo "sed -i 's/freeapis-proxy:5001/localhost:5001/g' /etc/cliproxy/config.yaml" >> /start.sh && \
|
| 41 |
-
echo "
|
| 42 |
echo "cd /app/freeapis-proxy && PORT=5001 python3 server.py > /tmp/freeapis.log 2>&1 &" >> /start.sh && \
|
| 43 |
-
echo "
|
| 44 |
-
echo "PORT=8081 python3 /opt/puter/puter/server.py --port 8081 > /tmp/puter.log 2>&1 &" >> /start.sh && \
|
| 45 |
-
echo "echo 'Starting Go Proxy (7860)...'" >> /start.sh && \
|
| 46 |
echo "exec /usr/local/bin/cliproxy -config /etc/cliproxy/config.yaml -port 7860" >> /start.sh && \
|
| 47 |
chmod +x /start.sh
|
| 48 |
|
| 49 |
EXPOSE 7860
|
| 50 |
|
| 51 |
-
ENTRYPOINT ["/start.sh"]
|
|
|
|
| 5 |
RUN go mod download
|
| 6 |
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/cliproxy ./cmd/server/
|
| 7 |
|
| 8 |
+
# 2. Runtime Environment
|
| 9 |
+
FROM debian:bookworm-slim
|
| 10 |
|
| 11 |
USER root
|
| 12 |
|
| 13 |
+
# Install dependencies including CA certificates which are critical for Go HTTP clients
|
| 14 |
+
RUN apt-get update && apt-get install -y python3-pip curl git procps ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
# Copy Proxy Binary
|
| 17 |
COPY --from=builder /app/cliproxy /usr/local/bin/cliproxy
|
| 18 |
+
|
| 19 |
+
# Copy Configuration & Assets
|
| 20 |
COPY config.yaml /etc/cliproxy/config.yaml
|
| 21 |
COPY static /etc/cliproxy/static
|
| 22 |
|
|
|
|
| 25 |
WORKDIR /app/freeapis-proxy
|
| 26 |
RUN pip3 install --break-system-packages -r requirements.txt || pip3 install -r requirements.txt
|
| 27 |
|
| 28 |
+
# Setup Puter (Using pip install approach for debian base if we stick to this, otherwise manual install)
|
| 29 |
+
# Actually, let's keep it simple: Puter is complex. For now, let's focus on getting the Go Proxy working.
|
| 30 |
+
# If Go Proxy works, we can re-add Puter.
|
| 31 |
+
# Disabling Puter temporarily to ensure CORE functionality.
|
| 32 |
+
|
| 33 |
+
# FORCE STATIC PATH
|
| 34 |
ENV MANAGEMENT_STATIC_PATH=/etc/cliproxy/static
|
| 35 |
|
| 36 |
WORKDIR /app
|
| 37 |
RUN mkdir -p /app/auth && chmod 777 /app/auth
|
| 38 |
|
| 39 |
+
# Create a robust startup script
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
RUN echo "#!/bin/bash" > /start.sh && \
|
| 41 |
+
echo "set -e" >> /start.sh && \
|
| 42 |
+
echo "--- STARTUP: Fixing Config ---" >> /start.sh && \
|
| 43 |
echo "sed -i 's/freeapis-proxy:5001/localhost:5001/g' /etc/cliproxy/config.yaml" >> /start.sh && \
|
| 44 |
+
echo "--- STARTUP: Launching FreeAPIs (Background) ---" >> /start.sh && \
|
| 45 |
echo "cd /app/freeapis-proxy && PORT=5001 python3 server.py > /tmp/freeapis.log 2>&1 &" >> /start.sh && \
|
| 46 |
+
echo "--- STARTUP: Launching Go Proxy (Foreground) ---" >> /start.sh && \
|
|
|
|
|
|
|
| 47 |
echo "exec /usr/local/bin/cliproxy -config /etc/cliproxy/config.yaml -port 7860" >> /start.sh && \
|
| 48 |
chmod +x /start.sh
|
| 49 |
|
| 50 |
EXPOSE 7860
|
| 51 |
|
| 52 |
+
ENTRYPOINT ["/start.sh"]
|