Update Dockerfile
Browse files- Dockerfile +8 -66
Dockerfile
CHANGED
@@ -89,20 +89,17 @@ ENV PYTHONUNBUFFERED=1 \
|
|
89 |
MALLOC_ARENA_MAX=2 \
|
90 |
# Application settings
|
91 |
WEBSCOUT_HOST=0.0.0.0 \
|
92 |
-
WEBSCOUT_PORT=
|
93 |
WEBSCOUT_WORKERS=1 \
|
94 |
WEBSCOUT_LOG_LEVEL=info \
|
95 |
# Authentication settings (new)
|
96 |
-
WEBSCOUT_NO_AUTH=
|
97 |
-
WEBSCOUT_NO_RATE_LIMIT=
|
98 |
WEBSCOUT_DATA_DIR=/app/data \
|
99 |
-
# Auto-rebuild settings (new)
|
100 |
-
WEBSCOUT_AUTO_REBUILD=false \
|
101 |
-
WEBSCOUT_REBUILD_INTERVAL=14400 \
|
102 |
# FastAPI metadata (new)
|
103 |
-
WEBSCOUT_API_TITLE="Webscout
|
104 |
WEBSCOUT_API_DESCRIPTION="OpenAI API compatible interface for various LLM providers with enhanced authentication" \
|
105 |
-
WEBSCOUT_API_VERSION="0.
|
106 |
WEBSCOUT_API_DOCS_URL="/docs" \
|
107 |
WEBSCOUT_API_REDOC_URL="/redoc" \
|
108 |
WEBSCOUT_API_OPENAPI_URL="/openapi.json"
|
@@ -130,64 +127,8 @@ RUN chown -R webscout:webscout /app
|
|
130 |
# COPY --chown=webscout:webscout . /app
|
131 |
|
132 |
# Create directories for logs and data with proper permissions
|
133 |
-
RUN mkdir -p /app/logs /app/data
|
134 |
-
chown -R webscout:webscout /app/logs /app/data
|
135 |
-
|
136 |
-
# Create simple auto-rebuild script for standalone use
|
137 |
-
RUN cat > /app/scripts/auto-rebuild.sh << 'EOF'
|
138 |
-
#!/bin/bash
|
139 |
-
set -e
|
140 |
-
|
141 |
-
# Auto-rebuild script for Webscout
|
142 |
-
# Updates the webscout package every WEBSCOUT_REBUILD_INTERVAL seconds (default: 4 hours)
|
143 |
-
|
144 |
-
REBUILD_INTERVAL=${WEBSCOUT_REBUILD_INTERVAL:-14400} # 4 hours in seconds
|
145 |
-
LOG_FILE="/app/logs/auto-rebuild.log"
|
146 |
-
|
147 |
-
log() {
|
148 |
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
149 |
-
}
|
150 |
-
|
151 |
-
update_webscout() {
|
152 |
-
log "Starting webscout update process..."
|
153 |
-
|
154 |
-
# Activate virtual environment
|
155 |
-
source /opt/venv/bin/activate
|
156 |
-
|
157 |
-
# Update webscout package
|
158 |
-
log "Updating webscout package from git repository..."
|
159 |
-
pip install -U git+https://github.com/OEvortex/Webscout.git#egg=webscout[api] || {
|
160 |
-
log "ERROR: Failed to update webscout package"
|
161 |
-
return 1
|
162 |
-
}
|
163 |
-
|
164 |
-
log "Webscout package updated successfully"
|
165 |
-
return 0
|
166 |
-
}
|
167 |
-
|
168 |
-
# Main loop
|
169 |
-
log "Auto-rebuild service started with interval: ${REBUILD_INTERVAL} seconds"
|
170 |
-
|
171 |
-
while true; do
|
172 |
-
if [ "${WEBSCOUT_AUTO_REBUILD:-false}" = "true" ]; then
|
173 |
-
log "Auto-rebuild is enabled, performing update..."
|
174 |
-
if update_webscout; then
|
175 |
-
log "Update completed successfully"
|
176 |
-
else
|
177 |
-
log "Update failed, will retry in next cycle"
|
178 |
-
fi
|
179 |
-
else
|
180 |
-
log "Auto-rebuild is disabled, skipping update"
|
181 |
-
fi
|
182 |
-
|
183 |
-
log "Sleeping for ${REBUILD_INTERVAL} seconds..."
|
184 |
-
sleep "$REBUILD_INTERVAL"
|
185 |
-
done
|
186 |
-
EOF
|
187 |
-
|
188 |
-
# Make script executable
|
189 |
-
RUN chmod +x /app/scripts/auto-rebuild.sh && \
|
190 |
-
chown -R webscout:webscout /app/scripts
|
191 |
|
192 |
# Switch to non-root user
|
193 |
USER webscout
|
@@ -200,4 +141,5 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
200 |
CMD curl -f http://localhost:${WEBSCOUT_PORT:-8000}/health || exit 1
|
201 |
|
202 |
# Default command - start the webscout API server with new auth system
|
|
|
203 |
CMD ["python", "-m", "webscout.auth.server"]
|
|
|
89 |
MALLOC_ARENA_MAX=2 \
|
90 |
# Application settings
|
91 |
WEBSCOUT_HOST=0.0.0.0 \
|
92 |
+
WEBSCOUT_PORT=7860 \
|
93 |
WEBSCOUT_WORKERS=1 \
|
94 |
WEBSCOUT_LOG_LEVEL=info \
|
95 |
# Authentication settings (new)
|
96 |
+
WEBSCOUT_NO_AUTH=true \
|
97 |
+
WEBSCOUT_NO_RATE_LIMIT=true \
|
98 |
WEBSCOUT_DATA_DIR=/app/data \
|
|
|
|
|
|
|
99 |
# FastAPI metadata (new)
|
100 |
+
WEBSCOUT_API_TITLE="Webscout API" \
|
101 |
WEBSCOUT_API_DESCRIPTION="OpenAI API compatible interface for various LLM providers with enhanced authentication" \
|
102 |
+
WEBSCOUT_API_VERSION="0.3.0" \
|
103 |
WEBSCOUT_API_DOCS_URL="/docs" \
|
104 |
WEBSCOUT_API_REDOC_URL="/redoc" \
|
105 |
WEBSCOUT_API_OPENAPI_URL="/openapi.json"
|
|
|
127 |
# COPY --chown=webscout:webscout . /app
|
128 |
|
129 |
# Create directories for logs and data with proper permissions
|
130 |
+
RUN mkdir -p /app/logs /app/data && \
|
131 |
+
chown -R webscout:webscout /app/logs /app/data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
# Switch to non-root user
|
134 |
USER webscout
|
|
|
141 |
CMD curl -f http://localhost:${WEBSCOUT_PORT:-8000}/health || exit 1
|
142 |
|
143 |
# Default command - start the webscout API server with new auth system
|
144 |
+
# Environment variables will be used by the application
|
145 |
CMD ["python", "-m", "webscout.auth.server"]
|