-
Notifications
You must be signed in to change notification settings - Fork 898
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (40 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
52 lines (40 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# FinRL Trading Platform Dockerfile
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/app/src
ENV PYTHONPATH=/app:$PYTHONPATH
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY src/ ./src/
COPY setup.py .
COPY README.md .
COPY .env* ./
# Install the package in development mode
RUN pip install -e .
# Create necessary directories
RUN mkdir -p data logs
# Create non-root user
RUN useradd --create-home --shell /bin/bash app \
&& chown -R app:app /app
USER app
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD python -c "import sys; sys.path.insert(0, '/app/src'); import config; print('Health check passed')" || exit 1
# Expose port for web interface
EXPOSE 8501
# Default command - use the main CLI
CMD ["python", "src/main.py", "dashboard"]