-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.azure
More file actions
39 lines (29 loc) · 1.1 KB
/
Dockerfile.azure
File metadata and controls
39 lines (29 loc) · 1.1 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
# Simplified Dockerfile for Azure App Service (Backend only)
# Frontend is now deployed as an Azure Static Web App
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements
COPY backend/requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend source
COPY backend/ .
# Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/health')"
# Set environment variable for Azure
ENV FLASK_ENV=azure
ENV PORT=8000
ENV AZURE_DEPLOYMENT=true
# Start application with gunicorn for production
# Note: With eventlet worker, we must use only 1 worker for WebSocket support
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--worker-class", "eventlet", "--workers", "1", "--timeout", "120", "--log-level", "info", "wsgi:app"]