# Stage 1: Build stage with all dependencies FROM python:3.11-slim as builder WORKDIR /app # Install build dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ libssl-dev \ zlib1g-dev \ libbz2-dev \ libreadline-dev \ libsqlite3-dev \ wget \ curl \ llvm \ libncurses5-dev \ libncursesw5-dev \ xz-utils \ tk-dev \ libffi-dev \ liblzma-dev \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --user --no-cache-dir -r requirements.txt # Stage 2: Runtime image FROM python:3.11-slim WORKDIR /app # Copy only the necessary files from builder COPY --from=builder /root/.local /root/.local COPY fix_oeg_server.py fix_server.cfg ./ COPY FIX44.xml . # Ensure scripts in .local are usable ENV PATH=/root/.local/bin:$PATH EXPOSE 5001 CMD ["python", "fix_oeg_server.py"]