-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prod
More file actions
35 lines (26 loc) · 875 Bytes
/
Dockerfile.prod
File metadata and controls
35 lines (26 loc) · 875 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
25
26
27
28
29
30
31
32
33
34
35
# Production Dockerfile for Pulsefeed
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install production WSGI server
RUN pip install --no-cache-dir gunicorn
# Copy application code
COPY . .
# Create instance directory
RUN mkdir -p /app/instance
# Create non-root user for security
RUN adduser --disabled-password --gecos '' appuser && \
chown -R appuser:appuser /app
USER appuser
ENV PORT=5000
EXPOSE 5000
# Run with gunicorn + eventlet for WebSocket support
# Workers=1 required for Flask-SocketIO (maintains socket state)
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:5000", "app:app"]