SandhyaRaghav's picture
Update Dockerfile
fa23c4d verified
# FROM python:3.9-slim
# WORKDIR /app
# # Install system dependencies
# RUN apt-get update && apt-get install -y \
# build-essential \
# curl \
# software-properties-common \
# git \
# && rm -rf /var/lib/apt/lists/*
# # Copy requirements.txt and install Python dependencies
# COPY requirements.txt ./
# RUN pip3 install -r requirements.txt
# # Copy the 'src' folder into the container's '/app/src' directory
# COPY src/ ./src/
# # IMPORTANT: Copy all other files and folders from the project root
# # (like .streamlit/, helper.py, preprocessor.py, stop_hinglish.txt, etc.)
# # into the container's /app directory.
# COPY . .
# # Set environment variable for Matplotlib cache to a writable directory
# ENV MPLCONFIGDIR=/tmp
# EXPOSE 8501
# HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# # Entrypoint to run your Streamlit application from its location in src/
# ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
FROM python:3.9-slim
WORKDIR /app
# Install necessary system dependencies, excluding the problematic 'software-properties-common'
# 'build-essential' is for compiling Python dependencies if needed.
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements.txt and install Python dependencies
COPY requirements.txt ./
RUN pip3 install -r requirements.txt
# Copy the application files.
# It's better practice to keep app.py and helper/preprocessor in the root if Streamlit app is in src/,
# but following your structure:
COPY src/ ./src/
# Copy essential files that the Streamlit app relies on directly (like stop_hinglish.txt)
COPY . .
# Set environment variable for Matplotlib cache to a writable directory
ENV MPLCONFIGDIR=/tmp
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Entrypoint to run your Streamlit application from its location in src/
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]