topGdev commited on
Commit
8b959f3
·
1 Parent(s): 6fe38bc

Add Dockerfile for HF Spaces deployment

Browse files
Files changed (2) hide show
  1. .dockerignore +33 -0
  2. Dockerfile +33 -0
.dockerignore ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ .Python
6
+ venv/
7
+ env/
8
+ .venv
9
+ .git
10
+ .gitignore
11
+ .env.local
12
+ .env.*.local
13
+ *.log
14
+ .DS_Store
15
+ node_modules/
16
+ .next/
17
+ dist/
18
+ build/
19
+ *.egg-info/
20
+ .pytest_cache/
21
+ .coverage
22
+ htmlcov/
23
+ .vscode/
24
+ .idea/
25
+ *.swp
26
+ *.swo
27
+ *~
28
+ .env
29
+ .env.example
30
+ README.md
31
+ .dockerignore
32
+ Dockerfile
33
+ .github/
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # Based on HF Spaces best practices
3
+
4
+ FROM python:3.12-slim-bullseye
5
+
6
+ # Update system packages to patch vulnerabilities
7
+ RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
8
+
9
+ # Create non-root user for security
10
+ RUN useradd -m -u 1000 user
11
+ USER user
12
+ ENV PATH="/home/user/.local/bin:$PATH"
13
+
14
+ WORKDIR /app
15
+
16
+ # Copy and install requirements
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
+
20
+ # Download NLTK data
21
+ RUN python -m nltk.downloader stopwords wordnet punkt_tab
22
+
23
+ # Install Playwright browsers
24
+ RUN playwright install chromium
25
+
26
+ # Copy application code
27
+ COPY --chown=user . /app
28
+
29
+ # Expose port (HF Spaces uses 7860)
30
+ EXPOSE 7860
31
+
32
+ # Run the application
33
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]