File size: 1,306 Bytes
e1ef3ec 1bc2953 e1ef3ec 1bc2953 e1ef3ec 3ab2b61 1bc2953 d88dd2f 1bc2953 d88dd2f e1ef3ec d88dd2f |
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 |
# 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"] |