File size: 1,311 Bytes
092e3d5 fd95cd8 092e3d5 fd95cd8 092e3d5 87e1426 9ff5f0f | 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 | # ============================================================================
# Online Exam IDE — Frontend Dockerfile
# ============================================================================
# Streamlit-based frontend
# ============================================================================
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create app directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY frontend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy frontend source code
COPY frontend/ .
# Expose Streamlit default port
EXPOSE 8501
# Health check - use 127.0.0.1 to avoid IPv6 resolution issues in Docker
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request, os; port=os.environ.get('PORT', '8501'); urllib.request.urlopen(f'http://127.0.0.1:{port}/_stcore/health')" || exit 1
# Run Streamlit using the dynamic PORT provided by the platform (e.g. Railway)
CMD sh -c "streamlit run app.py --server.port=${PORT:-8501} --server.address=0.0.0.0 --server.headless=true --server.enableCORS=false --server.enableXsrfProtection=false --server.enableWebsocketCompression=false --browser.gatherUsageStats=false"
|