36 lines
826 B
Docker
36 lines
826 B
Docker
# WiFi ETL — Docker Image
|
|
FROM python:3.11-slim
|
|
|
|
# System deps
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
cron \
|
|
gcc \
|
|
libpq-dev \
|
|
procps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Workdir
|
|
WORKDIR /app
|
|
|
|
# Python deps
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Code
|
|
COPY app ./app
|
|
COPY infra/init.sql /docker-entrypoint-initdb.d/
|
|
COPY infra/entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
# Crontab
|
|
COPY infra/crontab /etc/cron.d/wifi-etl
|
|
RUN chmod 0644 /etc/cron.d/wifi-etl && \
|
|
crontab /etc/cron.d/wifi-etl
|
|
|
|
# Log dir
|
|
RUN mkdir -p /var/log && touch /var/log/wifi-etl.log /var/log/wifi-etl-cleanup.log
|
|
|
|
# Entrypoint executa ETL uma vez, depois inicia cron
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
CMD ["cron", "-f"]
|