Spaces:
Build error
Build error
Commit ·
1eedb14
1
Parent(s): ae9f1da
run files
Browse files- Dockerfile +30 -0
- requirements.txt +10 -0
Dockerfile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight and stable Python 3.11 base image
|
| 2 |
+
FROM python:3.11-slim-buster AS base
|
| 3 |
+
|
| 4 |
+
# Set environment variables for production
|
| 5 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
+
PATH="/home/user/.local/bin:$PATH"
|
| 8 |
+
|
| 9 |
+
# Add a non-root user for security
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
|
| 12 |
+
# Switch to non-root user
|
| 13 |
+
USER user
|
| 14 |
+
|
| 15 |
+
# Set working directory
|
| 16 |
+
WORKDIR /app
|
| 17 |
+
|
| 18 |
+
# Install dependencies
|
| 19 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 20 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 21 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
| 22 |
+
|
| 23 |
+
# Copy application files
|
| 24 |
+
COPY --chown=user . /app
|
| 25 |
+
|
| 26 |
+
# Expose the application port
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Command to run the application
|
| 30 |
+
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4", "--log-level", "info"]
|
requirements.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.100.0
|
| 2 |
+
uvicorn==0.23.2
|
| 3 |
+
pymongo==4.7.0
|
| 4 |
+
motor==3.1.1
|
| 5 |
+
redis==4.6.0
|
| 6 |
+
python-jose==3.3.0
|
| 7 |
+
bcrypt==4.0.1
|
| 8 |
+
python-dotenv==1.0.0
|
| 9 |
+
bloom-filter2==2.0.0
|
| 10 |
+
phonenumbers==8.13.18
|