-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 953 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 953 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
34
35
36
37
38
39
40
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Accept build arg for git commit (for Sentry release tracking)
ARG GIT_COMMIT=dev
ENV GIT_COMMIT=$GIT_COMMIT
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
libmagic1 \
libmagic-dev \
&& rm -rf /var/lib/apt/lists/*
# Install uv
RUN pip install uv
# Copy dependency files first (for better caching)
COPY pyproject.toml ./
COPY uv.lock ./
# Install Python dependencies
RUN uv sync --frozen --no-dev
# Copy application code
COPY . .
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser -m
RUN chown -R appuser:appuser /app /root/.cache
RUN mkdir -p /home/appuser/.cache && chown -R appuser:appuser /home/appuser/.cache
USER appuser
# Expose port
EXPOSE 8000
# Start application
CMD ["uv", "run", "--frozen", "--no-dev", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]