# Use an official Python runtime as a parent image FROM python:3.10-slim-bookworm # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Set work directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ libc-dev \ libffi-dev \ git \ curl \ wget \ libnss3-tools \ gnupg \ tree \ && rm -rf /var/lib/apt/lists/* # Install Git LFS RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ apt-get update && \ apt-get install -y git-lfs && \ rm -rf /var/lib/apt/lists/* # Install Mkcert RUN wget -O mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 \ && chmod +x mkcert \ && mv mkcert /usr/local/bin/ # Copy the current directory contents into the container COPY . . # Display the directory structure RUN echo "Directory structure:" && tree -L 2 # Install requirements if a requirements.txt file exists RUN if [ -f requirements.txt ]; then \ echo "Installing from requirements.txt" && \ pip install --no-cache-dir -r requirements.txt; \ else \ echo "No requirements.txt found"; \ fi # Attempt to install GoEx RUN if [ -f setup.py ]; then \ echo "Installing GoEx using setup.py" && \ pip install --no-cache-dir -e .; \ elif [ -f pyproject.toml ]; then \ echo "Installing GoEx using pyproject.toml" && \ pip install --no-cache-dir .; \ else \ echo "No setup.py or pyproject.toml found. Searching for goex directory."; \ if [ -d goex ]; then \ echo "goex directory found. Adding to PYTHONPATH" && \ echo 'export PYTHONPATH="/app:$PYTHONPATH"' >> /root/.bashrc; \ else \ echo "goex directory not found. Unable to install or locate GoEx."; \ fi \ fi # Set up SQLite (as it's the default and doesn't require additional services) RUN mkdir -p /app/data && touch /app/data/goex_demo.db # Upgrade pip RUN pip install --upgrade pip # List installed packages RUN pip list # Expose port 80 (if needed for any web interfaces) EXPOSE 80 # Set the default command to run when starting the container CMD ["bash", "-c", "echo 'Python path:' && python -c 'import sys; print(sys.path)' && echo 'Attempting to import goex:' && python -c 'import goex; print(\"GoEx version:\", goex.__version__)' || echo 'Failed to import goex'"]