# Start from a base Python image | |
FROM python:3.12-slim | |
# Install wget and other potential necessities like ca-certificates | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
wget \ | |
ca-certificates \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy your setup script and application files | |
COPY setup.sh . | |
COPY requirements.txt . | |
COPY app.py . | |
COPY src/ ./src/ | |
# Make setup.sh executable and run it | |
RUN chmod +x setup.sh && ./setup.sh | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Environment variables for MiniZinc | |
ENV MZN_DIR=/opt/minizinc | |
ENV PATH="${MZN_DIR}/bin:${PATH}" | |
# If MiniZinc has shared libraries in MZN_DIR/lib that are needed at runtime: | |
ENV LD_LIBRARY_PATH="${MZN_DIR}/lib:${LD_LIBRARY_PATH}" | |
# Expose the port Gradio runs on (default is 7860) | |
EXPOSE 7860 | |
CMD ["python", "app.py"] |