Samuraiog commited on
Commit
a37bf59
·
verified ·
1 Parent(s): dbd26b7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -15
Dockerfile CHANGED
@@ -1,30 +1,69 @@
1
- FROM python:3.11-slim
 
2
 
3
- ENV PYTHONUNBUFFERED=1 \
4
- PYTHONDONTWRITEBYTECODE=1
 
 
5
 
6
- # Install system dependencies
7
- RUN apt-get update && apt-get install -y --no-install-recommends \
8
  gcc \
9
  g++ \
10
  make \
11
- libffi-dev \
12
- libcap2-bin \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Set working directory
16
- WORKDIR /app
 
17
 
18
- # Copy and install Python dependencies
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir --upgrade pip && \
21
  pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copy application code
24
- COPY main.py .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- # Expose API port
 
 
 
 
 
 
 
 
 
 
27
  EXPOSE 8000
28
 
29
- # Run the application
30
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
 
 
 
 
 
 
 
 
1
+ # Phoenix Fury v9.0 - Production Dockerfile
2
+ # Multi-stage build for optimal size and security
3
 
4
+ # ============================================================================
5
+ # Stage 1: Builder
6
+ # ============================================================================
7
+ FROM python:3.11-slim as builder
8
 
9
+ # Install build dependencies
10
+ RUN apt-get update && apt-get install -y \
11
  gcc \
12
  g++ \
13
  make \
14
+ libssl-dev \
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Create virtual environment
18
+ RUN python -m venv /opt/venv
19
+ ENV PATH="/opt/venv/bin:$PATH"
20
 
21
+ # Copy requirements and install
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir --upgrade pip && \
24
  pip install --no-cache-dir -r requirements.txt
25
 
26
+ # ============================================================================
27
+ # Stage 2: Runtime
28
+ # ============================================================================
29
+ FROM python:3.11-slim
30
+
31
+ # Install runtime dependencies only
32
+ RUN apt-get update && apt-get install -y \
33
+ libssl3 \
34
+ curl \
35
+ && rm -rf /var/lib/apt/lists/*
36
+
37
+ # Copy virtual environment from builder
38
+ COPY --from=builder /opt/venv /opt/venv
39
+
40
+ # Set environment variables
41
+ ENV PATH="/opt/venv/bin:$PATH" \
42
+ PYTHONUNBUFFERED=1 \
43
+ PYTHONDONTWRITEBYTECODE=1 \
44
+ WORKERS=1 \
45
+ HOST=0.0.0.0 \
46
+ PORT=8000
47
 
48
+ # Create non-root user for security (will be overridden if root is needed)
49
+ RUN useradd -m -u 1000 phoenix && \
50
+ mkdir -p /app && \
51
+ chown -R phoenix:phoenix /app
52
+
53
+ WORKDIR /app
54
+
55
+ # Copy application
56
+ COPY phoenix_fury_v9.py .
57
+
58
+ # Expose port
59
  EXPOSE 8000
60
 
61
+ # Health check
62
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
63
+ CMD curl -f http://localhost:8000/ || exit 1
64
+
65
+ # Default to non-root user (use --privileged and --user root for L4 attacks)
66
+ USER phoenix
67
+
68
+ # Start application
69
+ CMD ["python", "-u", "phoenix_fury_v9.py"]