Spaces:
Runtime error
Runtime error
Move Dockerfile to root, merge frontend + backend
Browse files- Dockerfile +29 -0
- backend/Dockerfile +0 -15
- create_structure.py +0 -51
- docker-compose.yml +0 -53
- frontend/Dockerfile +0 -22
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Copy backend + frontend requirements (if separate)
|
| 6 |
+
COPY ./backend/requirements.txt /app/backend_requirements.txt
|
| 7 |
+
COPY ./frontend/requirements.txt /app/frontend_requirements.txt
|
| 8 |
+
|
| 9 |
+
# Install all dependencies
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 11 |
+
pip install --no-cache-dir -r /app/backend_requirements.txt && \
|
| 12 |
+
pip install --no-cache-dir -r /app/frontend_requirements.txt && \
|
| 13 |
+
python -m spacy download en_core_web_sm
|
| 14 |
+
|
| 15 |
+
# Copy all project files
|
| 16 |
+
COPY ./backend /app/backend
|
| 17 |
+
COPY ./frontend /app/frontend
|
| 18 |
+
|
| 19 |
+
# Make frontend start script executable
|
| 20 |
+
RUN chmod +x /app/frontend/start.sh
|
| 21 |
+
|
| 22 |
+
# HF will provide APP_PORT for the Space
|
| 23 |
+
ENV APP_PORT=$APP_PORT
|
| 24 |
+
|
| 25 |
+
# Expose frontend port (Space uses APP_PORT)
|
| 26 |
+
EXPOSE $APP_PORT
|
| 27 |
+
|
| 28 |
+
# Start both backend and frontend
|
| 29 |
+
CMD ["sh", "-c", "uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 & /app/frontend/start.sh --server.port=$APP_PORT --server.address=0.0.0.0"]
|
backend/Dockerfile
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
COPY ./requirements.txt /app/requirements.txt
|
| 6 |
-
|
| 7 |
-
RUN pip install --no-cache-dir --upgrade pip && \
|
| 8 |
-
pip install --no-cache-dir -r requirements.txt && \
|
| 9 |
-
python -m spacy download en_core_web_sm
|
| 10 |
-
|
| 11 |
-
COPY ./app /app/app
|
| 12 |
-
|
| 13 |
-
EXPOSE 8000
|
| 14 |
-
|
| 15 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create_structure.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
|
| 3 |
-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 4 |
-
|
| 5 |
-
folders = [
|
| 6 |
-
"backend/app/api/endpoints",
|
| 7 |
-
"backend/app/core",
|
| 8 |
-
"backend/app/services",
|
| 9 |
-
"backend/app/schemas",
|
| 10 |
-
"frontend"
|
| 11 |
-
]
|
| 12 |
-
|
| 13 |
-
files = [
|
| 14 |
-
"backend/app/api/endpoints/analysis.py",
|
| 15 |
-
"backend/app/core/config.py",
|
| 16 |
-
"backend/app/services/document_parser.py",
|
| 17 |
-
"backend/app/services/scoring_engine.py",
|
| 18 |
-
"backend/app/services/vector_store.py",
|
| 19 |
-
"backend/app/schemas/models.py",
|
| 20 |
-
"backend/app/main.py",
|
| 21 |
-
"backend/Dockerfile",
|
| 22 |
-
"backend/requirements.txt",
|
| 23 |
-
"frontend/dashboard.py",
|
| 24 |
-
"frontend/credentials.json",
|
| 25 |
-
"frontend/Dockerfile",
|
| 26 |
-
"frontend/requirements.txt",
|
| 27 |
-
"docker-compose.yml",
|
| 28 |
-
".env"
|
| 29 |
-
]
|
| 30 |
-
|
| 31 |
-
def create_folders():
|
| 32 |
-
for folder in folders:
|
| 33 |
-
path = os.path.join(BASE_DIR, folder)
|
| 34 |
-
os.makedirs(path, exist_ok=True)
|
| 35 |
-
print(f"Created folder: {path}")
|
| 36 |
-
|
| 37 |
-
def create_files():
|
| 38 |
-
for file in files:
|
| 39 |
-
path = os.path.join(BASE_DIR, file)
|
| 40 |
-
os.makedirs(os.path.dirname(path), exist_ok=True)
|
| 41 |
-
if not os.path.exists(path):
|
| 42 |
-
with open(path, "w") as f:
|
| 43 |
-
f.write("")
|
| 44 |
-
print(f"Created file: {path}")
|
| 45 |
-
else:
|
| 46 |
-
print(f"File already exists: {path}")
|
| 47 |
-
|
| 48 |
-
if __name__ == "__main__":
|
| 49 |
-
create_folders()
|
| 50 |
-
create_files()
|
| 51 |
-
print("\n✅ Folder structure and files created successfully!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker-compose.yml
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
version: '3.8'
|
| 2 |
-
|
| 3 |
-
services:
|
| 4 |
-
backend:
|
| 5 |
-
build: ./backend
|
| 6 |
-
container_name: resume_screener_backend
|
| 7 |
-
ports:
|
| 8 |
-
- "8000:8000"
|
| 9 |
-
volumes:
|
| 10 |
-
- ./backend/app:/app/app
|
| 11 |
-
env_file:
|
| 12 |
-
- .env
|
| 13 |
-
depends_on:
|
| 14 |
-
chromadb:
|
| 15 |
-
condition: service_healthy # Wait for ChromaDB to be healthy
|
| 16 |
-
networks:
|
| 17 |
-
- resume_network
|
| 18 |
-
|
| 19 |
-
frontend:
|
| 20 |
-
build: ./frontend
|
| 21 |
-
container_name: resume_screener_frontend
|
| 22 |
-
ports:
|
| 23 |
-
- "8501:8501"
|
| 24 |
-
volumes:
|
| 25 |
-
- ./frontend:/app
|
| 26 |
-
env_file:
|
| 27 |
-
- .env
|
| 28 |
-
depends_on:
|
| 29 |
-
- backend
|
| 30 |
-
networks:
|
| 31 |
-
- resume_network
|
| 32 |
-
|
| 33 |
-
chromadb:
|
| 34 |
-
image: chromadb/chroma
|
| 35 |
-
container_name: resume_screener_chromadb
|
| 36 |
-
ports:
|
| 37 |
-
- "8001:8000"
|
| 38 |
-
volumes:
|
| 39 |
-
- chroma_data:/chroma/chroma
|
| 40 |
-
healthcheck:
|
| 41 |
-
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat"]
|
| 42 |
-
interval: 30s
|
| 43 |
-
timeout: 10s
|
| 44 |
-
retries: 5
|
| 45 |
-
networks:
|
| 46 |
-
- resume_network
|
| 47 |
-
|
| 48 |
-
networks:
|
| 49 |
-
resume_network:
|
| 50 |
-
driver: bridge
|
| 51 |
-
|
| 52 |
-
volumes:
|
| 53 |
-
chroma_data:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/Dockerfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
# frontend/Dockerfile
|
| 2 |
-
|
| 3 |
-
FROM python:3.11-slim
|
| 4 |
-
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Copy requirements first for better caching
|
| 8 |
-
COPY ./requirements.txt /app/requirements.txt
|
| 9 |
-
|
| 10 |
-
RUN pip install --no-cache-dir --upgrade pip && \
|
| 11 |
-
pip install --no-cache-dir -r requirements.txt
|
| 12 |
-
|
| 13 |
-
# Copy the entire frontend directory content into the container
|
| 14 |
-
COPY . /app/
|
| 15 |
-
|
| 16 |
-
# Make the startup script executable inside the container
|
| 17 |
-
RUN chmod +x /app/start.sh
|
| 18 |
-
|
| 19 |
-
EXPOSE 8501
|
| 20 |
-
|
| 21 |
-
# Set the startup script as the command to run when the container starts
|
| 22 |
-
CMD ["/app/start.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|