| FROM ghcr.io/kayolenjoy/tricochat:latest |
|
|
| USER root |
|
|
| RUN mkdir -p /gw && cd /gw && npm init -y && npm install http-proxy && rm -rf /root/.npm |
|
|
| COPY gateway.js /gw/gateway.js |
| COPY trico-proxy.js /trico-proxy.js |
| COPY librechat.yaml /app/librechat.yaml |
|
|
| RUN mkdir -p /app/api/logs /app/uploads /app/images /app/data && \ |
| chmod -R 777 /app/api/logs /app/uploads /app/images /app/data /gw |
|
|
| |
| RUN echo '#!/bin/sh' > /start.sh && \ |
| echo 'BRAND="${BRANDO:-Trico}"' >> /start.sh && \ |
| echo 'echo "[$BRAND] Starting..."' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Whitelabel yaml' >> /start.sh && \ |
| echo 'sed -i "s/__BRAND__/$BRAND/g" /app/librechat.yaml 2>/dev/null || true' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Whitelabel frontend' >> /start.sh && \ |
| echo 'find /app/client/dist -type f \( -name "*.js" -o -name "*.html" \) -exec sed -i "s/LibreChat/$BRAND/g" {} \; 2>/dev/null || true' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Auto-generate crypto if not set' >> /start.sh && \ |
| echo 'export CREDS_KEY="${CREDS_KEY:-$(cat /proc/sys/kernel/random/uuid | tr -d - | head -c 32)}"' >> /start.sh && \ |
| echo 'export CREDS_IV="${CREDS_IV:-$(cat /proc/sys/kernel/random/uuid | tr -d - | head -c 16)}"' >> /start.sh && \ |
| echo 'export JWT_SECRET="${JWT_SECRET:-$(cat /proc/sys/kernel/random/uuid)}"' >> /start.sh && \ |
| echo 'export JWT_REFRESH_SECRET="${JWT_REFRESH_SECRET:-$(cat /proc/sys/kernel/random/uuid)}"' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Environment' >> /start.sh && \ |
| echo 'export APP_TITLE="$BRAND"' >> /start.sh && \ |
| echo 'export PORT=3080' >> /start.sh && \ |
| echo 'export HOST=0.0.0.0' >> /start.sh && \ |
| echo 'export ENDPOINTS=custom' >> /start.sh && \ |
| echo 'export ALLOW_REGISTRATION=true' >> /start.sh && \ |
| echo 'export ALLOW_SOCIAL_LOGIN=false' >> /start.sh && \ |
| echo 'export CONFIG_PATH=/app/librechat.yaml' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Start proxy + gateway in background' >> /start.sh && \ |
| echo 'node /trico-proxy.js &' >> /start.sh && \ |
| echo 'node /gw/gateway.js &' >> /start.sh && \ |
| echo 'sleep 2' >> /start.sh && \ |
| echo '' >> /start.sh && \ |
| echo '# Backend as main process (logs visible!)' >> /start.sh && \ |
| echo 'exec npm run backend' >> /start.sh && \ |
| chmod +x /start.sh |
|
|
| EXPOSE 7860 |
|
|
| CMD ["/start.sh"] |