find_it_or_create_it / Dockerfile
manganapallydeepa's picture
Upload 8 files
32199b1 verified
# Dockerfile - build this image locally and push it to Hugging Face registry
FROM python:3.10-slim
# Avoid .pyc and unbuffered stdout for logs
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set HF/transformers cache to a folder we control (avoid permission issues)
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/transformers
ENV XDG_CACHE_HOME=/app/.cache
# The port your Flask app will listen on inside container
ENV PORT=7860
WORKDIR /app
# Install small system deps that commonly help (adjust if not needed)
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential curl git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first so Docker caches dependency installation
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy app sources (all files including out_index, images, templates)
COPY . /app
# Make sure cache dir exists and is writable
RUN mkdir -p /app/.cache/huggingface /app/.cache/transformers \
&& chmod -R 777 /app/.cache
# Expose the port used by Hugging Face Docker Spaces
EXPOSE 7860
# Do NOT put secrets here. They will be set in env at runtime (HF settings or docker run).
ENV GMAIL_USER=""
ENV GMAIL_PASSWORD=""
ENV TELEGRAM_BOT_TOKEN=""
ENV TELEGRAM_CHAT_ID=""
ENV JSON_URL=""
# Run the Flask app (your app uses os.environ.get("PORT"))
CMD ["python", "app.py"]