stack_overflow / Dockerfile
shujath000's picture
Update Dockerfile
dfcbfef verified
FROM python:3.13-slim
WORKDIR /app
# Environment variables
ENV HOME=/app
ENV XDG_CONFIG_HOME=/app/.streamlit
ENV NLTK_DATA=/app/nltk_data
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# Create necessary directories
RUN mkdir -p /app/.streamlit /app/nltk_data && chmod -R 777 /app
# Copy files
COPY requirements.txt ./
COPY src/ ./src/
COPY src/c_d.csv ./src/
COPY src/logistic_models.pkl ./src/
COPY src/tfidf.pkl ./src/
COPY src/multilabels.pkl ./src/
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# ๐Ÿ‘‡ Run NLTK downloads only after nltk is installed
RUN python -m nltk.downloader -d /app/nltk_data punkt averaged_perceptron_tagger wordnet stopwords
RUN python -m nltk.downloader -d /app/nltk_data punkt punkt_tab averaged_perceptron_tagger wordnet stopwords
# Expose port
EXPOSE 8501
# Start app
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]