Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
+
ENV PYTHONUNBUFFERED 1
|
| 7 |
+
|
| 8 |
+
# Set the working directory in the container
|
| 9 |
+
WORKDIR /code
|
| 10 |
+
|
| 11 |
+
# Install system dependencies that might be needed by some Python packages
|
| 12 |
+
# (Example: You might need build-essential if packages compile C code)
|
| 13 |
+
# RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Install Python dependencies
|
| 16 |
+
COPY requirements.txt .
|
| 17 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 18 |
+
pip install --no-cache-dir -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy the rest of the application code into the container
|
| 21 |
+
# Copy app directory first
|
| 22 |
+
COPY ./app /code/app
|
| 23 |
+
# Copy static files
|
| 24 |
+
COPY ./static /code/static
|
| 25 |
+
# Copy index.html
|
| 26 |
+
COPY ./index.html /code/index.html
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Expose the port the app runs on
|
| 30 |
+
# Hugging Face Spaces will map this port (default is 7860, but we use 8000 here)
|
| 31 |
+
EXPOSE 8000
|
| 32 |
+
|
| 33 |
+
# Define the command to run the application
|
| 34 |
+
# Use 0.0.0.0 to make it accessible from outside the container
|
| 35 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|