-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
24 lines (18 loc) · 856 Bytes
/
Dockerfile
File metadata and controls
24 lines (18 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file into the container at /app
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
# Add --no-cache-dir to reduce image size
RUN pip install --no-cache-dir -r requirements.txt
# Copy the main application file into the container at /app
COPY main.py .
# Make port 8050 available - Gunicorn will bind to this
EXPOSE 8050
# Run the application using Gunicorn
# 'main:server' tells Gunicorn to look for the 'server' object in the 'main.py' file
# '--bind 0.0.0.0:8050' makes the app accessible from outside the container on port 8050
# You can adjust the number of workers (-w) based on your needs
CMD ["gunicorn", "-w", "4", "--bind", "0.0.0.0:8050", "main:server"]