rework server startup and cli
Some checks failed
Security Scan / dependency-check (push) Successful in 43s
Security Scan / security (push) Successful in 47s
Test Suite / lint (push) Failing after 29s
Test Suite / test (3.11) (push) Successful in 1m28s
Test Suite / build (push) Has been skipped

This changes the dockerfile as well.
This commit is contained in:
2025-10-01 19:01:13 -07:00
parent 0d4145df06
commit d66a20ddda
14 changed files with 195 additions and 177 deletions

View File

@@ -23,9 +23,6 @@ COPY pyproject.toml uv.lock ./
# Copy source code (needed for editable install)
COPY src/ src/
COPY main.py .
COPY wsgi.py .
COPY run_prod.py .
COPY assets/ assets/
# Change ownership of source files before building (lighter I/O)
@@ -59,10 +56,7 @@ RUN chown appuser:appuser /app
# Copy files from builder with correct ownership
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
COPY --from=builder --chown=appuser:appuser /app/src /app/src
COPY --from=builder --chown=appuser:appuser /app/main.py /app/main.py
COPY --from=builder --chown=appuser:appuser /app/assets /app/assets
COPY --from=builder --chown=appuser:appuser /app/wsgi.py /app/wsgi.py
COPY --from=builder --chown=appuser:appuser /app/run_prod.py /app/run_prod.py
# Switch to non-root user
USER appuser
@@ -86,5 +80,5 @@ EXPOSE 8050
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8050/', timeout=5)" || exit 1
# Run application with Gunicorn in production
CMD ["python", "run_prod.py"]
# Run application in production mode (no debug, no auto-reload)
CMD ["embeddingbuddy", "serve"]