adithya9903 commited on
Commit
ec115fe
·
1 Parent(s): 2043afa

Add root Docker setup for Hugging Face Spaces.

Browse files

Provide a top-level Dockerfile and dockerignore so the Space can detect the app and build from the nested openenv-polypharmacy project.

Made-with: Cursor

Files changed (2) hide show
  1. .dockerignore +11 -0
  2. Dockerfile +39 -0
.dockerignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .gitignore
3
+ **/__pycache__
4
+ **/*.pyc
5
+ **/.pytest_cache
6
+ **/.mypy_cache
7
+ **/.ruff_cache
8
+ **/node_modules
9
+ **/dist
10
+ **/.env
11
+ **/.env.*
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-alpine AS frontend-builder
2
+ WORKDIR /app/frontend
3
+ COPY openenv-polypharmacy/frontend/package*.json ./
4
+ RUN npm ci
5
+ COPY openenv-polypharmacy/frontend/ ./
6
+ RUN npm run build
7
+
8
+ FROM python:3.11-slim
9
+
10
+ RUN apt-get update && \
11
+ apt-get install -y --no-install-recommends build-essential curl && \
12
+ rm -rf /var/lib/apt/lists/*
13
+
14
+ WORKDIR /app
15
+
16
+ COPY openenv-polypharmacy/backend/requirements.txt /app/backend/requirements.txt
17
+ RUN pip install --no-cache-dir -r /app/backend/requirements.txt
18
+
19
+ COPY openenv-polypharmacy/backend /app/backend
20
+ COPY openenv-polypharmacy/data /app/data
21
+ COPY openenv-polypharmacy/scripts /app/scripts
22
+ COPY openenv-polypharmacy/openenv.yaml /app/openenv.yaml
23
+ COPY openenv-polypharmacy/.env.example /app/.env.example
24
+ COPY openenv-polypharmacy/inference.py /app/inference.py
25
+
26
+ COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
27
+
28
+ RUN python3 /app/scripts/preprocess_data.py
29
+
30
+ ENV PORT=7860
31
+ ENV PYTHONPATH="/app/backend/src:${PYTHONPATH}"
32
+ ENV PYTHONUNBUFFERED=1
33
+
34
+ EXPOSE 7860
35
+
36
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=15s --retries=3 \
37
+ CMD curl -f http://localhost:7860/health || exit 1
38
+
39
+ CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port ${PORT:-7860}"]