-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.api
More file actions
30 lines (21 loc) · 811 Bytes
/
Dockerfile.api
File metadata and controls
30 lines (21 loc) · 811 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
FROM python:3.12.10-alpine3.21
WORKDIR /app
# Copy requirements first for better caching
COPY api/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy only specific directories instead of everything
COPY api/ ./api/
# Copy LICENSE and README files
COPY README.md /README.md
COPY LICENSE /LICENSE
LABEL license="MIT"
# Set the working directory to the api folder
WORKDIR /app/api
# Let mypy resolve absolute imports from /app
ENV PYTHONPATH=/app/api
# Run mypy to catch runtime-like type errors (commented out for faster builds) Can be run via Makefile
# RUN mypy .
# Expose the port FastAPI runs on
EXPOSE 5000
# Command to run the application from api directory
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000", "--workers", "4", "--timeout-keep-alive", "60"]