-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (22 loc) · 784 Bytes
/
Dockerfile
File metadata and controls
34 lines (22 loc) · 784 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
# syntax=docker/dockerfile:1
# --- build stage ---
FROM python:3.12-slim AS builder
WORKDIR /build
COPY pyproject.toml README.md ./
COPY src/ src/
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir build \
&& python -m build --wheel --outdir /build/dist
# --- api runtime stage ---
FROM python:3.12-slim AS api
# Non-root user
RUN addgroup --system app && adduser --system --ingroup app app
WORKDIR /app
# Install wheel from builder
COPY --from=builder /build/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm /tmp/*.whl
# Create data directory with correct ownership
RUN mkdir -p /app/data && chown app:app /app/data
USER app
EXPOSE 8000
CMD ["uvicorn", "schulmanager_api.main:app", "--host", "0.0.0.0", "--port", "8000"]