SilentWraith's picture
Update Dockerfile
1bc2953 verified
raw
history blame
1.31 kB
# Stage 1: Build
FROM python:3.11-slim as builder
WORKDIR /app
# Install git
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Clone the public repository
RUN git clone https://github.com/exis000/HeartDiseasePredictor_Model.git /app/HeartDiseasePredictor_Model
# Set the working directory to the cloned repository
WORKDIR /app/HeartDiseasePredictor_Model
# Print all files in the repository for debugging
RUN ls -R
# Ensure the model folder exists and extract the zip file using Python
RUN if [ -d "model" ]; then \
echo "Model folder found."; \
if [ -f "model/RandomForest_best_model.zip" ]; then \
echo "RandomForest_best_model.zip found. Extracting using Python..."; \
python -c "import zipfile; zipfile.ZipFile('model/RandomForest_best_model.zip', 'r').extractall('model/')"; \
else \
echo "ERROR: RandomForest_best_model.zip not found in the model folder."; \
exit 1; \
fi; \
else \
echo "ERROR: Model folder not found."; \
exit 1; \
fi
# Install Python dependencies
RUN pip install --upgrade pip && \
pip install -r requirements.txt
# Run the main script
CMD ["python", "-m", "deployment.Api.app"]