first commit
This commit is contained in:
+55
@@ -0,0 +1,55 @@
|
||||
# Dockerfile pour Homelab Automation Dashboard avec Ansible
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Métadonnées
|
||||
LABEL maintainer="Homelab Automation"
|
||||
LABEL description="Dashboard d'automatisation Homelab avec FastAPI et Ansible"
|
||||
LABEL version="1.0"
|
||||
|
||||
# Variables d'environnement
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV ANSIBLE_HOST_KEY_CHECKING=False
|
||||
ENV ANSIBLE_RETRY_FILES_ENABLED=False
|
||||
|
||||
# Répertoire de travail
|
||||
WORKDIR /app
|
||||
|
||||
# Installation des dépendances système pour Ansible et SSH
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssh-client \
|
||||
sshpass \
|
||||
ansible \
|
||||
git \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean
|
||||
|
||||
# Création du répertoire SSH et configuration
|
||||
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
|
||||
|
||||
# Copie des requirements et installation des dépendances Python
|
||||
COPY app/requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copie du code de l'application
|
||||
COPY app/ ./
|
||||
|
||||
# Copie de la configuration Ansible
|
||||
COPY ansible/ /ansible/
|
||||
|
||||
# Création du répertoire pour les clés SSH (sera monté en volume)
|
||||
RUN mkdir -p /app/ssh_keys
|
||||
|
||||
# Configuration Ansible pour utiliser le bon répertoire
|
||||
ENV ANSIBLE_CONFIG=/ansible/ansible.cfg
|
||||
|
||||
# Exposition du port
|
||||
EXPOSE 8000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/api/health || exit 1
|
||||
|
||||
# Commande de démarrage
|
||||
CMD ["python", "-m", "uvicorn", "app_optimized:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in New Issue
Block a user