draft-estimation / Dockerfile
PauloFN's picture
sqlite error
b328cfc
# 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"]