36 lines
778 B
Docker
36 lines
778 B
Docker
# Dockerfile for ESPHome Webhook Service
|
|
FROM python:3.11-slim
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install ESPHome
|
|
RUN pip install --no-cache-dir esphome
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY app.py .
|
|
|
|
# Create config directory
|
|
RUN mkdir -p /config
|
|
|
|
# Expose webhook service port
|
|
EXPOSE 5000
|
|
|
|
# Environment variables
|
|
ENV ESPHOME_CONFIG_DIR=/config
|
|
ENV AUTO_COMPILE=true
|
|
ENV AUTO_UPLOAD=false
|
|
ENV DEBOUNCE_SECONDS=5
|
|
|
|
# Run the webhook service
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", "--timeout", "600", "app:app"]
|