-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1.46 KB
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 1.46 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
# ============================================================
# Adaptive Crisis Management Environment — Production Dockerfile
# Hugging Face Spaces compatible (port 7860, non-root user)
# ============================================================
FROM python:3.10-slim
# ---- System-level hardening & metadata -------------------------
LABEL maintainer="Meta Capstone Team" \
version="4.0.0" \
description="OpenEnv-compliant Crisis Management RL Environment API"
# Prevent Python from writing .pyc files and buffering stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# ---- Working directory -----------------------------------------
WORKDIR /app
# ---- Non-root user (Hugging Face Spaces security requirement) ---
RUN useradd -m -u 1000 appuser
# ---- Python dependencies (installed as root for system-wide access) ----
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# ---- Application source ----------------------------------------
# Set Difference Architecture: Copy everything, filtered strictly by .dockerignore
COPY --chown=appuser:appuser . .
# ---- Switch to non-root user -----------------------------------
USER 1000
# ---- Network ---------------------------------------------------
EXPOSE 7860
# ---- Runtime ---------------------------------------------------
# Hugging Face Spaces expects the service to bind on 0.0.0.0:7860
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]