-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.4 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (31 loc) · 1.4 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
# Dockerfile for Predictive Occupancy Modeling API
#
# This image installs the project as a Python package along with its
# dependencies and exposes a FastAPI server for training and
# querying occupancy models. Jupyter and plotting utilities have
# been removed to keep the image lightweight. The container
# automatically runs the API under uvicorn on port 8000.
FROM python:3.12-slim
# Install system packages required for building some Python wheels
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the entire repository into the container
COPY . /app
# Upgrade pip and install the project in editable mode. FastAPI and
# uvicorn are installed via the project's dependencies declared in
# pyproject.toml.
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -e .
# Expose the API port
EXPOSE 8000
# Default command: launch the FastAPI server via uvicorn. Uvicorn
# will read the app object from src.api and listen on all interfaces.
# Run the FastAPI server from the new api.app module. The working
# directory is added to sys.path by uvicorn so ``api.app:app`` resolves
# correctly. Note that ``src/api.py`` remains for backward
# compatibility but ``api/app.py`` is now the canonical entrypoint.
CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "8000"]