File size: 1,846 Bytes
a37bf59
 
3f0c05b
a37bf59
 
 
 
3f0c05b
a37bf59
 
3f0c05b
 
 
a37bf59
04d660e
 
a37bf59
 
 
745881b
a37bf59
4cb2999
 
 
 
a37bf59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745881b
a37bf59
 
 
 
 
 
 
 
 
 
 
745881b
 
a37bf59
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Phoenix Fury v9.0 - Production Dockerfile
# Multi-stage build for optimal size and security

# ============================================================================
# Stage 1: Builder
# ============================================================================
FROM python:3.11-slim as builder

# Install build dependencies
RUN apt-get update && apt-get install -y \
    gcc \
    g++ \
    make \
    libssl-dev \
    && rm -rf /var/lib/apt/lists/*

# Create virtual environment
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# ============================================================================
# Stage 2: Runtime
# ============================================================================
FROM python:3.11-slim

# Install runtime dependencies only
RUN apt-get update && apt-get install -y \
    libssl3 \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy virtual environment from builder
COPY --from=builder /opt/venv /opt/venv

# Set environment variables
ENV PATH="/opt/venv/bin:$PATH" \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    WORKERS=1 \
    HOST=0.0.0.0 \
    PORT=8000

# Create non-root user for security (will be overridden if root is needed)
RUN useradd -m -u 1000 phoenix && \
    mkdir -p /app && \
    chown -R phoenix:phoenix /app

WORKDIR /app

# Copy application
COPY phoenix_fury_v9.py .

# Expose port
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8000/ || exit 1

# Default to non-root user (use --privileged and --user root for L4 attacks)
USER phoenix

# Start application
CMD ["python", "-u", "phoenix_fury_v9.py"]