WeavePrompt / Dockerfile
kevin1kevin1k's picture
Upload folder using huggingface_hub
c6eb9ce verified
raw
history blame
1.26 kB
# Use Python 3.11 slim image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install UV package manager
RUN pip install uv
# Copy UV configuration files first for better caching
COPY pyproject.toml uv.lock ./
# Install Python dependencies using UV
RUN uv venv /opt/venv && \
. /opt/venv/bin/activate && \
uv sync --frozen
# Set the virtual environment as the default Python
ENV PATH="/opt/venv/bin:$PATH"
# Copy application code
COPY . .
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
# Set environment variables
ENV HOME=/home/user \
PATH="/opt/venv/bin:/home/user/.local/bin:$PATH" \
PYTHONPATH=/app
# Change to user's home directory
WORKDIR $HOME/app
# Copy app to user directory
COPY --chown=user . $HOME/app
# Expose the port Streamlit runs on
EXPOSE 7860
# Health check
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
# Run the Streamlit application
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true", "--server.fileWatcherType=none", "--browser.gatherUsageStats=false"]