-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.aif360.old
More file actions
66 lines (55 loc) · 1.99 KB
/
Dockerfile.aif360.old
File metadata and controls
66 lines (55 loc) · 1.99 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
# ============================================================================
# PRODUCTION DOCKERFILE FOR AIF360 FAIRNESS API - ROOT DEPLOYMENT
# Optimized for Railway.app deployment from repository root
# ============================================================================
# Use Python 3.11 slim image (balance between size and compatibility)
FROM python:3.11-slim-bookworm
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PORT=8000
# Install system dependencies required by AIF360
# These are the CRITICAL packages that Render free tier cannot install
RUN apt-get update && apt-get install -y --no-install-recommends \
# Required for scipy/numpy compilation
gcc \
g++ \
gfortran \
# Required for linear algebra operations
libblas-dev \
liblapack-dev \
# Required for building Python packages
python3-dev \
# Utilities
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy requirements from aif360-service subdirectory
COPY aif360-service/requirements.txt .
# Install Python dependencies
# Use --no-cache-dir to reduce image size
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy application code from aif360-service subdirectory
COPY aif360-service/app ./app/
# Create non-root user for security
RUN useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app
USER appuser
# Expose port (Railway will inject $PORT at runtime)
EXPOSE 8000
# Health check disabled for Railway (Railway uses external checks)
# HEALTHCHECK disabled
# Start command using Gunicorn with Uvicorn workers
# Railway injects PORT at runtime, fallback to 8000
CMD gunicorn app.main:app \
--workers 1 \
--worker-class uvicorn.workers.UvicornWorker \
--bind 0.0.0.0:${PORT:-8000} \
--timeout 120 \
--log-level info \
--access-logfile - \
--error-logfile -