Maksymilian Jankowski commited on
Commit
f022c87
·
1 Parent(s): b62d4a1

docker setuo

Browse files
Files changed (2) hide show
  1. .dockerignore +63 -0
  2. Dockerfile +43 -0
.dockerignore ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+
5
+ # Python
6
+ __pycache__
7
+ *.pyc
8
+ *.pyo
9
+ *.pyd
10
+ .Python
11
+ env
12
+ pip-log.txt
13
+ pip-delete-this-directory.txt
14
+ .tox
15
+ .coverage
16
+ .coverage.*
17
+ .cache
18
+ nosetests.xml
19
+ coverage.xml
20
+ *.cover
21
+ *.log
22
+ .pytest_cache
23
+
24
+ # Virtual environments
25
+ venv/
26
+ env/
27
+ ENV/
28
+ .venv/
29
+
30
+ # Node.js
31
+ node_modules/
32
+ npm-debug.log*
33
+ yarn-debug.log*
34
+ yarn-error.log*
35
+
36
+ # IDE
37
+ .vscode/
38
+ .idea/
39
+ *.swp
40
+ *.swo
41
+ *~
42
+
43
+ # OS
44
+ .DS_Store
45
+ .DS_Store?
46
+ ._*
47
+ .Spotlight-V100
48
+ .Trashes
49
+ ehthumbs.db
50
+ Thumbs.db
51
+
52
+ # Environment variables
53
+ .env
54
+ .env.local
55
+ .env.*.local
56
+
57
+ # Documentation
58
+ README.md
59
+ *.md
60
+
61
+ # Other
62
+ *.tmp
63
+ *.temp
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 slim image for better performance
2
+ FROM python:3.11-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ gcc \
10
+ g++ \
11
+ curl \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install Node.js (for any frontend dependencies)
15
+ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
16
+ && apt-get install -y nodejs
17
+
18
+ # Copy requirements first to leverage Docker cache
19
+ COPY requirements.txt .
20
+
21
+ # Install Python dependencies
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy package.json and install Node.js dependencies if they exist
25
+ COPY package*.json ./
26
+ RUN npm install
27
+
28
+ # Copy the rest of the application
29
+ COPY . .
30
+
31
+ # Create a non-root user
32
+ RUN useradd -m -u 1000 user
33
+ USER user
34
+
35
+ # Expose the port that Hugging Face Spaces expects
36
+ EXPOSE 7860
37
+
38
+ # Set environment variables for Hugging Face Spaces
39
+ ENV PYTHONUNBUFFERED=1
40
+ ENV PORT=7860
41
+
42
+ # Command to run the application
43
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]