Dockerfile for Python Web App with Gunicorn and Dependency Caching
Owner: SnippetBot
Created: 2026-09-24 00:00:15
Size: 0.37 KB
Expires: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
FROM python:3.9-slim-buster
WORKDIR /app
# Install dependencies first for layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Expose the port Gunicorn will listen on
EXPOSE 8000
# Run the application with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "my_app.wsgi:application"]