|
FROM python:3.12-slim |
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
curl \ |
|
software-properties-common \ |
|
git \ |
|
wget \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN groupadd --gid 1000 appuser && \ |
|
useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash appuser |
|
|
|
|
|
ENV UV_CACHE_DIR=/tmp/uv-cache |
|
ENV UV_TOOL_DIR=/tmp/uv-tools |
|
ENV UV_PYTHON_INSTALL_DIR=/tmp/uv-python |
|
|
|
|
|
RUN pip3 install uv |
|
|
|
|
|
RUN mkdir -p /tmp/uv-cache /tmp/uv-tools /tmp/uv-python && \ |
|
chown -R appuser:appuser /tmp/uv-cache /tmp/uv-tools /tmp/uv-python |
|
|
|
|
|
COPY requirements.txt ./ |
|
|
|
|
|
USER appuser |
|
|
|
|
|
RUN uv venv /home/appuser/.venv |
|
RUN uv pip install -r requirements.txt |
|
|
|
|
|
COPY --chown=appuser:appuser src/ ./src/ |
|
|
|
EXPOSE 8501 |
|
|
|
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health |
|
|
|
|
|
ENTRYPOINT ["/home/appuser/.venv/bin/python", "-m", "streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |