TrendRadar/docker/Dockerfile
2025-07-22 19:52:44 +08:00

39 lines
1.3 KiB
Docker

FROM python:3.10-slim
WORKDIR /app
# https://github.com/aptible/supercronic/releases
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.34/supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=e8631edc1775000d119b70fd40339a7238eece14 \
SUPERCRONIC=supercronic-linux-amd64
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
curl -fsSLO "$SUPERCRONIC_URL" && \
echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \
chmod +x "$SUPERCRONIC" && \
mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \
ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic && \
apt-get remove -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY main.py .
COPY docker/manage.py .
# 复制 entrypoint.sh 并强制转换为 LF 格式
COPY docker/entrypoint.sh /entrypoint.sh.tmp
RUN sed -i 's/\r$//' /entrypoint.sh.tmp && \
mv /entrypoint.sh.tmp /entrypoint.sh && \
chmod +x /entrypoint.sh && \
chmod +x manage.py && \
mkdir -p /app/config /app/output
ENV PYTHONUNBUFFERED=1 \
CONFIG_PATH=/app/config/config.yaml \
FREQUENCY_WORDS_PATH=/app/config/frequency_words.txt
ENTRYPOINT ["/entrypoint.sh"]