File size: 1,467 Bytes
f206b57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# TorchForge Production Dockerfile
# Author: Anil Prasad
# Multi-stage build for optimized production deployment

# Stage 1: Builder
FROM python:3.10-slim as builder

WORKDIR /build

# Install build dependencies
RUN apt-get update && apt-get install -y \

    build-essential \
    git \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir --user -r requirements.txt

# Stage 2: Production
FROM python:3.10-slim

LABEL maintainer="Anil Prasad <anilprasad@example.com>"
LABEL description="TorchForge - Enterprise-Grade PyTorch Framework"
LABEL version="1.0.0"

WORKDIR /app

# Install runtime dependencies
RUN apt-get update && apt-get install -y \

    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

# Copy Python dependencies from builder
COPY --from=builder /root/.local /root/.local

# Copy application code
COPY torchforge/ /app/torchforge/
COPY setup.py /app/
COPY README.md /app/

# Install TorchForge
RUN pip install --no-cache-dir -e .

# Create non-root user
RUN useradd -m -u 1000 torchforge && \

    chown -R torchforge:torchforge /app

USER torchforge

# Expose port for API
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \

    CMD python -c "import torchforge; print('healthy')" || exit 1

# Default command
CMD ["python", "-m", "torchforge.api.server"]