-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (41 loc) · 1.36 KB
/
Dockerfile
File metadata and controls
55 lines (41 loc) · 1.36 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
# Dockerfile para Python CDMX Charlas
# Basado en Python 3.11 slim para optimizar el tamaño
FROM python:3.11-slim
# Establecer variables de entorno
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Instalar dependencias del sistema
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
curl \
build-essential \
&& 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 requirements.txt .
# Instalar dependencias de Python
RUN pip install --no-cache-dir -r requirements.txt
# 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 ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
# Etiquetas de metadatos
LABEL maintainer="Python CDMX <info@pythoncdmx.org>" \
description="Sitio web oficial de Python CDMX Charlas" \
version="1.0.0" \
org.opencontainers.image.source="https://github.com/PythonMexico/pythonCDMX"