Spaces:
Runtime error
Runtime error
Upload Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use official Python image
|
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 && apt-get install -y \
|
10 |
+
wget \
|
11 |
+
unzip \
|
12 |
+
&& rm -rf /var/lib/apt/lists/*
|
13 |
+
|
14 |
+
# Set working directory
|
15 |
+
WORKDIR /app
|
16 |
+
|
17 |
+
# Copy requirements file and install dependencies
|
18 |
+
RUN --mount=type=cache,target=/root/.cache/pip \
|
19 |
+
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
20 |
+
python -m pip install -r requirements.txt
|
21 |
+
|
22 |
+
# Set the TRANSFORMERS_CACHE environment variable
|
23 |
+
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface
|
24 |
+
|
25 |
+
# Create the cache folder with appropriate permissions
|
26 |
+
RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE
|
27 |
+
|
28 |
+
# Copy application files
|
29 |
+
COPY . .
|
30 |
+
|
31 |
+
# Expose the port that the application listens on.
|
32 |
+
EXPOSE 8000
|
33 |
+
|
34 |
+
# Run the application.
|
35 |
+
CMD uvicorn 'main:app' --host=0.0.0.0 --port=7860
|