mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-17 18:35:19 +02:00
chore: update Docker configurations to streamline backend build and enhance E2E testing environment
This commit is contained in:
parent
efff7ab2a2
commit
242925d8e5
4 changed files with 18 additions and 4 deletions
|
|
@ -10,6 +10,11 @@
|
|||
|
||||
name: surfsense-dev
|
||||
|
||||
x-backend-build: &backend-build
|
||||
context: ../surfsense_backend
|
||||
args:
|
||||
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-sentence-transformers/all-MiniLM-L6-v2}
|
||||
|
||||
services:
|
||||
db:
|
||||
image: pgvector/pgvector:pg17
|
||||
|
|
@ -69,7 +74,7 @@ services:
|
|||
retries: 5
|
||||
|
||||
backend:
|
||||
build: ../surfsense_backend
|
||||
build: *backend-build
|
||||
ports:
|
||||
- "${BACKEND_PORT:-8000}:8000"
|
||||
volumes:
|
||||
|
|
@ -114,7 +119,7 @@ services:
|
|||
start_period: 200s
|
||||
|
||||
celery_worker:
|
||||
build: ../surfsense_backend
|
||||
build: *backend-build
|
||||
volumes:
|
||||
- ../surfsense_backend/app:/app/app
|
||||
- shared_temp:/shared_tmp
|
||||
|
|
@ -140,7 +145,7 @@ services:
|
|||
condition: service_healthy
|
||||
|
||||
celery_beat:
|
||||
build: ../surfsense_backend
|
||||
build: *backend-build
|
||||
env_file:
|
||||
- ../surfsense_backend/.env
|
||||
environment:
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ x-backend-env: &backend-env
|
|||
HTTPS_PROXY: http://127.0.0.1:1
|
||||
HTTP_PROXY: http://127.0.0.1:1
|
||||
NO_PROXY: localhost,127.0.0.1,0.0.0.0,db,redis,host.docker.internal
|
||||
HF_HUB_OFFLINE: "1"
|
||||
TRANSFORMERS_OFFLINE: "1"
|
||||
|
||||
services:
|
||||
db:
|
||||
|
|
@ -95,6 +97,8 @@ services:
|
|||
# tests/ is excluded from the main context by .dockerignore;
|
||||
# the e2e stage's `COPY --from=tests-source` pulls it in here.
|
||||
tests-source: ../surfsense_backend/tests
|
||||
args:
|
||||
EMBEDDING_MODEL: sentence-transformers/all-MiniLM-L6-v2
|
||||
cache_from:
|
||||
- type=gha,scope=surfsense-e2e-backend
|
||||
cache_to:
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ RUN printf '%s\n' \
|
|||
' pass' \
|
||||
| python || true
|
||||
|
||||
ARG EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
||||
RUN python -c "from chonkie import AutoEmbeddings; AutoEmbeddings.get_embeddings('${EMBEDDING_MODEL}')"
|
||||
|
||||
# Install Playwright browsers (the playwright python package itself is in deps)
|
||||
RUN playwright install chromium --with-deps
|
||||
|
||||
|
|
@ -104,6 +107,7 @@ RUN mkdir -p /shared_tmp
|
|||
ENV PYTHONPATH=/app
|
||||
ENV UVICORN_LOOP=asyncio
|
||||
ENV TMPDIR=/shared_tmp
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Tune glibc malloc to return freed memory to the OS more aggressively.
|
||||
# Without these, Python's gc.collect() frees objects but the underlying
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ wait_for_db() {
|
|||
# depends_on/healthchecks already gate on db readiness, this is just
|
||||
# belt-and-suspenders so a slow first connection doesn't race migrations.
|
||||
for i in {1..60}; do
|
||||
if python -c "from app.db import engine; import asyncio; asyncio.run(engine.dispose())" 2>/dev/null; then
|
||||
echo "[e2e-entrypoint] db check attempt ${i}/60"
|
||||
if python -c "from app.db import engine; import asyncio; asyncio.run(engine.dispose())"; then
|
||||
echo "[e2e-entrypoint] db reachable after ${i} attempts"
|
||||
return 0
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue