Spaces:
Sleeping
Sleeping
updated
Browse files- dockerfile +32 -16
dockerfile
CHANGED
@@ -1,28 +1,44 @@
|
|
1 |
-
# Use official Python image
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
-
# Create a non-root user for security
|
5 |
-
RUN useradd -m -u 1000 user
|
6 |
-
USER user
|
7 |
|
8 |
-
# Set environment variables
|
9 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
10 |
|
11 |
-
# Set working directory
|
12 |
-
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
# Copy
|
15 |
-
COPY --chown=user
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
# Expose the port used by the application
|
24 |
EXPOSE 7860
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
# Run the FastAPI app with Uvicorn
|
27 |
# CMD ["uvicorn", "src.backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
28 |
CMD ["sh", "-c", "fastapi dev src/backend/main.py --host 0.0.0.0 --port 8000"]
|
|
|
1 |
+
# # Use official Python image
|
2 |
+
# FROM python:3.9
|
3 |
|
4 |
+
# # Create a non-root user for security
|
5 |
+
# RUN useradd -m -u 1000 user
|
6 |
+
# USER user
|
7 |
|
8 |
+
# # Set environment variables
|
9 |
+
# ENV PATH="/home/user/.local/bin:$PATH"
|
10 |
|
11 |
+
# # Set working directory
|
12 |
+
# WORKDIR /app
|
13 |
+
|
14 |
+
# # Copy dependency file first (for better caching)
|
15 |
+
# COPY --chown=user requirements.txt /app/requirements.txt
|
16 |
+
|
17 |
+
# # Install dependencies
|
18 |
+
# RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
|
20 |
+
# # Copy the rest of the application code
|
21 |
+
# COPY --chown=user . /app
|
22 |
|
23 |
+
# # Expose the port used by the application
|
24 |
+
# EXPOSE 7860
|
25 |
|
26 |
+
FROM python:3.11
|
27 |
+
|
28 |
+
WORKDIR /app
|
29 |
+
|
30 |
+
COPY . /app
|
31 |
+
|
32 |
+
RUN pip install --upgrade pip
|
33 |
+
RUN pip install -r requirements.txt
|
34 |
|
|
|
35 |
EXPOSE 7860
|
36 |
|
37 |
+
# Ensure logs directory exists
|
38 |
+
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
|
39 |
+
|
40 |
+
ENV PYTHONPATH="/app/src"
|
41 |
+
|
42 |
# Run the FastAPI app with Uvicorn
|
43 |
# CMD ["uvicorn", "src.backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
44 |
CMD ["sh", "-c", "fastapi dev src/backend/main.py --host 0.0.0.0 --port 8000"]
|