forked from PythonistaMX/api-testing-demo
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 907 Bytes
/
Dockerfile
File metadata and controls
31 lines (22 loc) · 907 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
# Usamos tag versionado para evitar roturas por digests retirados y mantener
# una base estable en la rama 3.11.
FROM python:3.14-slim
# Instala el binario de uv para gestionar dependencias de forma reproducible.
COPY --from=ghcr.io/astral-sh/uv:0.7.22 /uv /uvx /bin/
# Reduce artefactos innecesarios y mejora observabilidad en logs.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
FLASK_APP=app.py
WORKDIR /demo
COPY requirements.runtime.txt ./
RUN uv pip install --system --no-cache --upgrade "setuptools>=80.0.0" "wheel>=0.46.2" \
&& uv pip install --system --no-cache -r requirements.runtime.txt
COPY app.py ./
COPY apiflaskdemo ./apiflaskdemo
COPY data ./data
RUN addgroup --system app && adduser --system --ingroup app app \
&& chown -R app:app /demo
# Evita ejecutar la app como root dentro del contenedor.
USER app
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]