-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (61 loc) · 2.28 KB
/
Copy pathDockerfile
File metadata and controls
80 lines (61 loc) · 2.28 KB
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
70
71
72
73
74
75
76
77
78
79
80
# Multi-stage build for PrivaseeAI.Security
# Stage 1: Builder - Install dependencies
FROM python:3.11-slim as builder
# Set metadata labels
LABEL maintainer="AurelianWare"
LABEL description="PrivaseeAI Security - Privacy-preserving iOS threat detection and monitoring system"
LABEL version="0.1.0"
# Set build arguments
ARG DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy only requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Stage 2: Runtime - Create minimal production image
FROM python:3.11-slim
# Set metadata labels
LABEL maintainer="AurelianWare"
LABEL description="PrivaseeAI Security - Privacy-preserving iOS threat detection and monitoring system"
LABEL version="0.1.0"
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN groupadd -r privasee && \
useradd -r -g privasee -u 1000 -m -s /bin/bash privasee
# Set working directory
WORKDIR /app
# Copy Python dependencies from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application source code
COPY --chown=privasee:privasee src/privaseeai_security /app/privaseeai_security
COPY --chown=privasee:privasee pyproject.toml /app/
COPY --chown=privasee:privasee scripts/healthcheck.py /app/scripts/healthcheck.py
# Create necessary directories
RUN mkdir -p /app/logs /app/data && \
chown -R privasee:privasee /app
# Switch to non-root user
USER privasee
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python /app/scripts/healthcheck.py || exit 1
# Expose port (placeholder for future API)
EXPOSE 8000
# Set entrypoint
ENTRYPOINT ["python", "-m"]
CMD ["privaseeai_security"]