first commit
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
# Dockerfile para Cisco MAC Monitor HTTPS Service
|
||||
# ===============================================
|
||||
FROM rockylinux:8
|
||||
|
||||
# Metadatos
|
||||
LABEL maintainer="Equipo de Monitorización de Red"
|
||||
LABEL description="Monitor de direcciones MAC para Cisco via HTTPS API con soporte SSH legacy"
|
||||
LABEL version="2.1-https-service"
|
||||
|
||||
# Variables de entorno
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
# Variables para el servicio HTTPS
|
||||
ENV HTTP_HOST=0.0.0.0
|
||||
ENV HTTP_PORT=8443
|
||||
|
||||
# Actualizar sistema e instalar dependencias base
|
||||
RUN dnf update -y && \
|
||||
dnf install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-devel \
|
||||
openssh-clients \
|
||||
gcc \
|
||||
openssl-devel \
|
||||
libffi-devel \
|
||||
krb5-devel \
|
||||
curl \
|
||||
openssl && \
|
||||
dnf clean all
|
||||
|
||||
# Crear usuario no privilegiado
|
||||
RUN useradd -m -u 1000 -s /bin/bash monitor
|
||||
|
||||
# Copiar requirements.txt primero para cache de Docker
|
||||
COPY requirements.txt /tmp/requirements.txt
|
||||
|
||||
# Instalar dependencias Python desde requirements.txt
|
||||
RUN pip3 install --no-cache-dir --upgrade pip && \
|
||||
pip3 install --no-cache-dir -r /tmp/requirements.txt && \
|
||||
rm /tmp/requirements.txt
|
||||
|
||||
# Cambiar al usuario no privilegiado
|
||||
USER monitor
|
||||
WORKDIR /app
|
||||
|
||||
# Copiar scripts principales
|
||||
COPY --chmod=755 --chown=monitor:monitor cisco_mac_monitor.py /app/
|
||||
COPY --chmod=755 --chown=monitor:monitor cisco_mac_http_service.py /app/
|
||||
|
||||
# Exponer puerto HTTPS
|
||||
EXPOSE 8443
|
||||
|
||||
# Healthcheck para el servicio HTTPS
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD curl -k -f https://localhost:8443/health || exit 1
|
||||
|
||||
# Entry point para el servicio HTTPS
|
||||
ENTRYPOINT ["python3", "/app/cisco_mac_http_service.py"]
|
||||
CMD ["--host", "0.0.0.0", "--port", "8443"]
|
||||
Reference in New Issue
Block a user