File size: 2,480 Bytes
8886ad0 e8a4e4c 7c336f4 8886ad0 7c336f4 8886ad0 7c336f4 8886ad0 e8a4e4c 2f47ad0 8886ad0 e8a4e4c 8886ad0 7c336f4 2f47ad0 4162c31 2f47ad0 8886ad0 2f47ad0 4162c31 2f47ad0 4162c31 2f47ad0 4162c31 2f47ad0 4162c31 8886ad0 4162c31 2f47ad0 8886ad0 7c336f4 8886ad0 2f47ad0 | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | # 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'"] |