-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.api
More file actions
33 lines (24 loc) · 890 Bytes
/
Dockerfile.api
File metadata and controls
33 lines (24 loc) · 890 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
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements from project root and install Python dependencies
COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user
RUN useradd --create-home --shell /bin/bash julee
USER julee
# Copy the application code with correct ownership
COPY --chown=julee:julee src/julee /app/julee
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# Expose the port the app runs on
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Default command - start the FastAPI server
CMD ["python", "-m", "uvicorn", "julee.api.app:app", "--host", "0.0.0.0", "--port", "8000"]