File size: 1,965 Bytes
6a6918c
 
 
 
 
 
 
 
 
 
 
 
 
2877363
 
 
 
 
 
 
 
 
16a32bc
ec8bffc
b328cfc
ec8bffc
6a6918c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Use an official Python runtime as a parent image.
# The "slim" variant is a good choice as it's smaller than the full version.
FROM python:3.11-slim

# Set environment variables to prevent Python from writing pyc files to disc
# and to prevent it from buffering stdout and stderr.
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set the working directory in the container to /app.
# This is where your application's code will live.
WORKDIR /app

RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    ffmpeg \
    libjpeg-dev \
    libpng-dev

RUN mkdir reports
RUN mkdir data

# Copy the requirements file into the container at /app.
# This is done as a separate step to take advantage of Docker's layer caching.
# If your requirements don't change, this layer won't be rebuilt, speeding up future builds.
COPY requirements.txt .

# Install any needed packages specified in requirements.txt.
# --no-cache-dir disables the pip cache, which helps keep the image size down.
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application's code into the container at /app.
COPY . .

# Expose a port to the outside world.
# Replace 8000 with the port your application listens on (e.g., 5000 for Flask, 8000 for FastAPI).
EXPOSE 8000

# Define the command to run your application.
# The command is broken into a list of strings for best practice.
# ---
# UNCOMMENT THE ONE YOU NEED AND EDIT IT ---
# ---

# For a generic Python script:
# CMD ["python", "main.py"]

# For a FastAPI application with uvicorn:
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]

# For a Flask application (using the development server):
# NOTE: For production, you should use a proper WSGI server like Gunicorn.
# CMD ["flask", "run", "--host=0.0.0.0", "--port=8000"]

# For a Flask application with Gunicorn:
# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "main:app"]