Writing_Tutor / Dockerfile
NavyDevilDoc's picture
Create Dockerfile
c6a4cf3 verified
raw
history blame
1.01 kB
# Use an official lightweight Python image.
# 3.11 is stable and faster than previous versions.
FROM python:3.11-slim
# Set environment variables
# PYTHONDONTWRITEBYTECODE: Prevents Python from writing pyc files to disc
# PYTHONUNBUFFERED: Prevents Python from buffering stdout and stderr
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Expose the port Streamlit runs on
EXPOSE 7860
# Healthcheck to ensure the container is responsive
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
# Command to run the application
# server.address=0.0.0.0 is crucial for Docker networking
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]