22 lines
584 B
Docker
22 lines
584 B
Docker
# Use a lightweight Python image
|
|
FROM python:3.11-slim
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the requirements file first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
|
|
# Install dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of your application code
|
|
COPY . .
|
|
|
|
# Expose the port Flask runs on (default is 5000)
|
|
EXPOSE 5000
|
|
|
|
# Run the application using Gunicorn for production
|
|
# Replace 'app:app' with 'your_filename:app_variable_name'
|
|
# CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
|
|
CMD ["python", "app.py"] |