-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (29 loc) · 1002 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (29 loc) · 1002 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
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Non-root user
RUN useradd --create-home --uid 10001 app
WORKDIR /app
# Install deps first for better layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Cache-busting arg so the COPY layer is never reused across deploys.
# The CD workflow passes a fresh value on every build; locally it just
# defaults to "dev". Without this, BuildKit can spuriously hit cache on
# `COPY app` even when the source actually changed.
ARG BUILD_MARKER=dev
ENV BUILD_MARKER=${BUILD_MARKER}
RUN echo "build=${BUILD_MARKER}"
# App code
COPY app ./app
USER 10001
EXPOSE 8080
# --proxy-headers + --forwarded-allow-ips lets uvicorn (and our rate limiter)
CMD ["uvicorn", "app.main:app", \
"--host", "0.0.0.0", \
"--port", "8080", \
"--proxy-headers", \
"--forwarded-allow-ips=*"]