-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.03 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
40
41
42
43
44
45
46
47
# Build stage
FROM python:3.10-slim as builder
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --user -r requirements.txt
# Runtime stage
FROM python:3.10-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Copy Python dependencies from builder
COPY --from=builder /root/.local /root/.local
# Ensure scripts in .local are usable
ENV PATH=/root/.local/bin:$PATH
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /app/uploads /app/logs
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Expose the port the app runs on
EXPOSE 8000
# Command to run the application
CMD ["uvicorn", "casebuilder.api.app:app", "--host", "0.0.0.0", "--port", "8000"]