amine_dubs commited on
Commit
d121cb4
·
1 Parent(s): d6d82c2

Restore backend files and ensure Dockerfile is in root

Browse files
Files changed (2) hide show
  1. Dockerfile +42 -0
  2. README.md +1 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python Alpine runtime as a parent image for smaller size
2
+ FROM python:3.13-alpine
3
+
4
+ # Set the working directory in the container
5
+ # All subsequent commands (COPY, RUN, CMD) use this path
6
+ WORKDIR /app
7
+
8
+ # Install system dependencies that might be needed by Python packages on Alpine
9
+ # Example for PyMuPDF: RUN apk add --no-cache musl-dev freetype-dev harfbuzz-dev jpeg-dev openjpeg-dev zlib-dev tiff-dev lcms2-dev
10
+ # RUN apk add --no-cache some-alpine-package
11
+
12
+ # Copy only the requirements file first to leverage Docker cache
13
+ COPY backend/requirements.txt /app/requirements.txt
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir --upgrade pip
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy the rest of the application code into the container
20
+ # This includes the backend directory, templates, static files etc.
21
+ # Adjust the source paths based on your project structure relative to the Dockerfile location
22
+ COPY backend/ /app/backend
23
+ COPY templates/ /app/templates
24
+ COPY static/ /app/static
25
+ # We don't copy uploads dir, it will be created by the app if needed
26
+
27
+ # Create the necessary directories within the container that the app expects
28
+ # Although the app tries to create them, it's good practice for Dockerfile to ensure they exist
29
+ RUN mkdir -p /app/templates /app/static /app/uploads
30
+
31
+ # Make port 8000 available to the world outside this container
32
+ # Hugging Face Spaces often map to this port from the outside world (port 7860 is also common)
33
+ EXPOSE 8000
34
+
35
+ # Define environment variable (optional)
36
+ # ENV NAME World
37
+
38
+ # Run main.py using uvicorn when the container launches
39
+ # The command needs to specify the location of the app module (backend.main:app)
40
+ # Host 0.0.0.0 makes it accessible from outside the container
41
+ # Add --reload flag for development if needed, but remove for production
42
+ CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
README.md CHANGED
@@ -4,6 +4,7 @@ emoji: 📊
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
 
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: docker
7
+ app_port: 8000 # Added required port for Docker SDK
8
  pinned: false
9
  ---
10