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