Spaces:
Sleeping
Sleeping
Hassan Ali Khan
commited on
Commit
·
ee01bda
1
Parent(s):
28f12ef
- Dockerfile +22 -11
Dockerfile
CHANGED
|
@@ -1,23 +1,34 @@
|
|
| 1 |
FROM python:3.13-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
-
curl build-essential
|
| 5 |
&& rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 9 |
-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
ENV UV_CACHE_DIR=/
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
-
COPY . .
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
|
|
|
|
|
|
| 20 |
EXPOSE 7860
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
CMD ["uv", "run", "chainlit", "run", "src/study_chatbot/app.py", "--host", "0.0.0.0", "--port", "$PORT"]
|
|
|
|
| 1 |
FROM python:3.13-slim
|
| 2 |
|
| 3 |
+
# system deps
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
curl git build-essential \
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
+
# install uv and make it globally available
|
| 9 |
+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
| 10 |
+
mv /root/.local/bin/uv /usr/local/bin/uv
|
| 11 |
|
| 12 |
+
# use HF persistent writable storage for uv cache
|
| 13 |
+
ENV UV_CACHE_DIR=/data/uvcache
|
| 14 |
+
|
| 15 |
+
# create a non-root user and give it ownership of /app and /data
|
| 16 |
+
RUN useradd -m -u 1000 appuser && mkdir -p /app /data/uvcache && \
|
| 17 |
+
chown -R appuser:appuser /app /data
|
| 18 |
|
| 19 |
WORKDIR /app
|
|
|
|
| 20 |
|
| 21 |
+
# copy code as appuser so files are writable at runtime
|
| 22 |
+
COPY --chown=appuser:appuser . /app
|
| 23 |
+
|
| 24 |
+
USER appuser
|
| 25 |
+
|
| 26 |
+
# install deps into project venv from uv.lock (fast/reproducible)
|
| 27 |
+
RUN uv --version && uv sync --frozen
|
| 28 |
|
| 29 |
+
# Spaces provides $PORT; default to 7860 for local runs
|
| 30 |
+
ENV PORT=7860
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
+
# start Chainlit
|
| 34 |
+
CMD ["uv", "run", "chainlit", "run", "src/study_chatbot/app.py", "--host", "0.0.0.0", "--port", "${PORT}"]
|