Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -2
Dockerfile
CHANGED
|
@@ -3,16 +3,23 @@ FROM python:3.10
|
|
| 3 |
|
| 4 |
WORKDIR /app
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Copy requirements.txt first to leverage Docker cache
|
| 7 |
COPY requirements.txt .
|
| 8 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Copy your application code and other necessary files
|
| 11 |
COPY app.py .
|
| 12 |
# COPY your_service_account_file.json . # If you use a JSON file instead of base64 secret
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
|
| 17 |
# Command to run your Flask application using a production-ready WSGI server like Gunicorn
|
| 18 |
# This assumes your Flask application instance is named 'app' in 'app.py'
|
|
|
|
| 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'
|