Create Dockerfile
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python 3.10 slim image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Environment settings
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Set working directory
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Install required system packages
|
| 12 |
+
RUN apt-get update && apt-get install -y procps wget && apt-get clean
|
| 13 |
+
|
| 14 |
+
# Download requirements.txt first for dependency caching
|
| 15 |
+
RUN wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/requirements.txt
|
| 16 |
+
|
| 17 |
+
# Install Python dependencies
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Download main.py
|
| 22 |
+
RUN wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/main.py
|
| 23 |
+
|
| 24 |
+
# Create the 'api' folder and download all internal API files
|
| 25 |
+
RUN mkdir api && cd api && \
|
| 26 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/app.py && \
|
| 27 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/auth.py && \
|
| 28 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/config.py && \
|
| 29 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/logger.py && \
|
| 30 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/utils.py && \
|
| 31 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/models.py && \
|
| 32 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/routes.py && \
|
| 33 |
+
wget https://huggingface.co/datasets/SuperAPIs/Data/resolve/main/api/validate.py
|
| 34 |
+
|
| 35 |
+
# Expose port
|
| 36 |
+
EXPOSE 8001
|
| 37 |
+
|
| 38 |
+
# Start the FastAPI app using uvicorn
|
| 39 |
+
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port 8001 --workers $(nproc)"]
|