-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 848 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 848 Bytes
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
FROM python:3.11-slim
# Set working directory (single source of truth)
WORKDIR /app
# System dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies (cached layer)
COPY requirements-api.txt .
RUN pip install --no-cache-dir -r requirements-api.txt
# NLTK resources (build-time, deterministic image)
RUN python -m nltk.downloader punkt
# Copy application code
COPY app/ ./app/
COPY src/ ./src/
# Copy model into application namespace (IMPORTANT)
COPY models/bioclinicalbert_final/ ./models/bioclinicalbert_final/
# Ensure Python can import src modules correctly
ENV PYTHONPATH=/app:/app/src
# Cloud Run port requirement
ENV PORT=8080
EXPOSE 8080
# Start server (Cloud Run compatible)
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]