FROM python:3.11-slim # Set working directory WORKDIR /app # Copy requirements first for better caching COPY requirements.txt . # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application COPY dyndns.py . # Make script executable RUN chmod +x dyndns.py # Run as non-root user RUN useradd -m -u 1000 dyndns && \ chown -R dyndns:dyndns /app USER dyndns # Health check HEALTHCHECK --interval=5m --timeout=10s --start-period=30s --retries=3 \ CMD python -c "import sys; sys.exit(0)" # Run the application CMD ["python", "-u", "dyndns.py"]