Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +30 -39
Dockerfile
CHANGED
|
@@ -1,39 +1,30 @@
|
|
| 1 |
-
# Use the official Python image as
|
| 2 |
-
FROM python:3.9-slim
|
| 3 |
-
|
| 4 |
-
# Set environment variables
|
| 5 |
-
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
-
ENV PYTHONUNBUFFERED 1
|
| 7 |
-
|
| 8 |
-
# Install system dependencies
|
| 9 |
-
RUN apt-get update \
|
| 10 |
-
&& apt-get install -y --no-install-recommends \
|
| 11 |
-
wget \
|
| 12 |
-
unzip \
|
| 13 |
-
&& apt-get clean \
|
| 14 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
-
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE
|
| 32 |
-
|
| 33 |
-
# Copy the FastAPI app into the container
|
| 34 |
-
COPY app.py .
|
| 35 |
-
|
| 36 |
-
EXPOSE 8000
|
| 37 |
-
|
| 38 |
-
# Command to run the FastAPI application using uvicorn
|
| 39 |
-
CMD uvicorn app:app --host 127.0.0.1 --port 8000
|
|
|
|
| 1 |
+
# Use the official Python image as the base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables for Python
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
+
ENV PYTHONUNBUFFERED 1
|
| 7 |
+
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update \
|
| 10 |
+
&& apt-get install -y --no-install-recommends \
|
| 11 |
+
wget \
|
| 12 |
+
unzip \
|
| 13 |
+
&& apt-get clean \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
# Install necessary Python packages
|
| 17 |
+
RUN pip install --upgrade pip
|
| 18 |
+
RUN pip install gradio transformers huggingface_hub
|
| 19 |
+
|
| 20 |
+
# Set working directory in the container
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy the Python script and model files into the container
|
| 24 |
+
COPY app.py /app/
|
| 25 |
+
|
| 26 |
+
# Expose port 7860 (default port for Gradio interface)
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Command to run the Python script with uvicorn when the container starts
|
| 30 |
+
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|