Spaces:
Sleeping
Sleeping
ezequiellopez
commited on
Commit
·
69e8f52
1
Parent(s):
3cd1a73
cleaning Dockerfile
Browse files- Dockerfile +10 -27
Dockerfile
CHANGED
@@ -1,42 +1,25 @@
|
|
1 |
# Dockerfile
|
2 |
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
COPY .env /app/.env
|
7 |
-
|
8 |
-
RUN pip install -r /app/requirements.txt
|
9 |
-
# Use the official Python image
|
10 |
-
FROM python:3.9-slim
|
11 |
-
|
12 |
-
# Set environment variables
|
13 |
ENV PYTHONDONTWRITEBYTECODE 1
|
14 |
ENV PYTHONUNBUFFERED 1
|
15 |
ENV HF_HOME /app/cache
|
16 |
|
17 |
-
# Install system dependencies
|
18 |
-
RUN apt-get update \
|
19 |
-
&& apt-get install -y --no-install-recommends \
|
20 |
-
gcc \
|
21 |
-
libpq-dev \
|
22 |
-
libhdf5-dev \
|
23 |
-
libc6 \
|
24 |
-
libgomp1 \
|
25 |
-
redis \
|
26 |
-
&& rm -rf /var/lib/apt/lists/*
|
27 |
-
|
28 |
# Set the working directory in the container
|
29 |
WORKDIR /app
|
30 |
|
31 |
-
#
|
32 |
-
COPY
|
33 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
34 |
|
35 |
-
# Copy the FastAPI application code into the container
|
36 |
-
COPY ./app
|
|
|
37 |
|
38 |
-
# Expose port
|
39 |
EXPOSE 7860
|
40 |
|
41 |
-
# Command to run the FastAPI application
|
42 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
# Dockerfile
|
2 |
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
|
3 |
|
4 |
+
# Set environment variables to prevent Python from writing pyc files to disk
|
5 |
+
# and to force unbuffered output (useful for Docker)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
ENV PYTHONDONTWRITEBYTECODE 1
|
7 |
ENV PYTHONUNBUFFERED 1
|
8 |
ENV HF_HOME /app/cache
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Set the working directory in the container
|
11 |
WORKDIR /app
|
12 |
|
13 |
+
# Upgrade pip to the latest version and install Python dependencies
|
14 |
+
COPY requirements.txt .
|
15 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
16 |
|
17 |
+
# Copy the FastAPI application code and other necessary files into the container
|
18 |
+
COPY ./app .
|
19 |
+
COPY .env .
|
20 |
|
21 |
+
# Expose port 7860 for the application
|
22 |
EXPOSE 7860
|
23 |
|
24 |
+
# Command to run the FastAPI application using uvicorn
|
25 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|