-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.39 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Dockerfile para Python CDMX Charlas
# Basado en Python 3.11 slim para optimizar el tamaño
FROM python:3.13-slim
# Establecer variables de entorno
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/app/.venv
# Instalar dependencias del sistema
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Crear usuario no-root para seguridad
RUN groupadd -r mkdocs && useradd -r -g mkdocs mkdocs
# Establecer directorio de trabajo
WORKDIR /app
# Copiar archivos de dependencias
COPY pyproject.toml uv.lock ./
# Instalar dependencias de Python
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# Copiar código fuente
COPY . .
# Cambiar propietario de archivos
RUN chown -R mkdocs:mkdocs /app
# Cambiar a usuario no-root
USER mkdocs
# Exponer puerto
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/ || exit 1
# Comando por defecto
CMD ["uv", "run", "mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
# Etiquetas de metadatos
LABEL maintainer="Python CDMX <[email protected]>" \
description="Sitio web oficial de Python CDMX Charlas" \
version="1.0.0" \
org.opencontainers.image.source="https://github.com/PythonMexico/pythonCDMX"