43V3RFX / Dockerfile
Nanny7's picture
feat: Initial Freqtrade HF Space deployment
260ef75
# Dockerfile for Freqtrade Strategy Showcase on Hugging Face Spaces
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies required for TA-Lib and other packages
RUN apt-get update && apt-get install -y \
build-essential \
wget \
curl \
pkg-config \
libffi-dev \
libssl-dev \
git \
&& rm -rf /var/lib/apt/lists/*
# Install TA-Lib from source (required for technical analysis)
RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
tar -xzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && \
./configure --prefix=/usr && \
make && \
make install && \
cd .. && \
rm -rf ta-lib ta-lib-0.4.0-src.tar.gz
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH="/app"
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT=7860
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY app.py .
COPY user_data/ ./user_data/
# Create necessary directories
RUN mkdir -p /app/user_data/logs /app/user_data/data
# Set permissions
RUN chmod -R 755 /app
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860 || exit 1
# Expose the port that Gradio will run on
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]