Futuresony commited on
Commit
561c0a7
·
verified ·
1 Parent(s): 3c0d822

Create Dockerrfile

Browse files
Files changed (1) hide show
  1. Dockerrfile +2 -20
Dockerrfile CHANGED
@@ -1,28 +1,10 @@
1
  FROM python:3.10
2
- # Use a Python version compatible with your packages
3
 
4
- WORKDIR /app
5
 
6
- # Create a non-root user
7
- RUN adduser --disabled-password --gecos '' appuser
8
- RUN chown -R appuser:appuser /app
9
-
10
- # Copy requirements.txt first to leverage Docker cache
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Download spacy model during the build phase
15
- RUN python -m spacy download en_core_web_sm
16
-
17
- # Copy your application code and other necessary files
18
  COPY app.py .
19
- # COPY your_service_account_file.json . # If you use a JSON file instead of base64 secret
20
-
21
- # Change to the non-root user
22
- USER appuser
23
 
24
- # Command to run your Flask application using a production-ready WSGI server like Gunicorn
25
- # This assumes your Flask application instance is named 'app' in 'app.py'
26
- # It binds to the PORT environment variable provided by the hosting environment.
27
- # Provide a default port (e.g., 7860) if the PORT environment variable is not set.
28
- CMD exec gunicorn --bind 0.0.0.0:${PORT:-7860} --workers 1 --threads 8 --timeout 0 app:app
 
1
  FROM python:3.10
 
2
 
3
+ WORKDIR /code
4
 
 
 
 
 
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
 
 
 
8
  COPY app.py .
 
 
 
 
9
 
10
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]