35 lines
745 B
Docker
35 lines
745 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 .
|
|
COPY gunicorn_config.py .
|
|
|
|
# Create config directory
|
|
RUN mkdir -p /config
|
|
|
|
# Expose webhook service port
|
|
EXPOSE 5000
|
|
|
|
# Environment variables
|
|
ENV ESPHOME_CONFIG_DIR=/config
|
|
ENV DEBOUNCE_SECONDS=5
|
|
|
|
# Run the webhook service with Gunicorn config
|
|
CMD ["gunicorn", "-c", "gunicorn_config.py", "app:app"]
|