Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +14 -13
Dockerfile
CHANGED
@@ -1,37 +1,38 @@
|
|
1 |
-
# Use the official Python image from Docker Hub
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Install
|
8 |
-
RUN apt-get update && apt-get install -y
|
9 |
-
git \
|
10 |
-
wget \
|
11 |
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
#
|
14 |
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface
|
15 |
|
16 |
# Set environment variables
|
17 |
ENV HF_HOME=/app/.cache/huggingface
|
18 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
19 |
|
|
|
|
|
|
|
|
|
20 |
# Configure Git
|
21 |
RUN git config --system user.email "[email protected]" && \
|
22 |
git config --system user.name "peace2024"
|
23 |
-
|
24 |
-
# Copy requirements
|
25 |
COPY requirements.txt .
|
26 |
|
27 |
-
# Install
|
28 |
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
# Copy the application code
|
31 |
COPY app.py .
|
32 |
|
33 |
-
# Expose the
|
34 |
EXPOSE 8000
|
35 |
|
36 |
-
#
|
37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
1 |
+
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install system dependencies
|
8 |
+
RUN apt-get update && apt-get install -y wget git tar && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
9 |
|
10 |
+
# Create a Hugging Face cache directory
|
11 |
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface
|
12 |
|
13 |
# Set environment variables
|
14 |
ENV HF_HOME=/app/.cache/huggingface
|
15 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
16 |
|
17 |
+
# Create and activate a virtual environment
|
18 |
+
RUN python3 -m venv /app/venv
|
19 |
+
ENV PATH="/app/venv/bin:$PATH"
|
20 |
+
|
21 |
# Configure Git
|
22 |
RUN git config --system user.email "[email protected]" && \
|
23 |
git config --system user.name "peace2024"
|
24 |
+
|
25 |
+
# Copy the requirements file
|
26 |
COPY requirements.txt .
|
27 |
|
28 |
+
# Install dependencies in the virtual environment
|
29 |
RUN pip install --no-cache-dir -r requirements.txt
|
30 |
|
31 |
# Copy the application code
|
32 |
COPY app.py .
|
33 |
|
34 |
+
# Expose the port FastAPI runs on
|
35 |
EXPOSE 8000
|
36 |
|
37 |
+
# Command to run the application
|
38 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|