Spaces:
Sleeping
Sleeping
Commit
·
44d2f53
1
Parent(s):
9f9da04
update
Browse files- Dockerfile +17 -7
Dockerfile
CHANGED
|
@@ -1,9 +1,6 @@
|
|
| 1 |
# Use Python 3.13 slim image
|
| 2 |
FROM python:3.13-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
|
@@ -14,9 +11,22 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
# Install uv
|
| 15 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Install dependencies and the package
|
| 22 |
RUN uv sync --frozen && uv pip install -e .
|
|
@@ -28,4 +38,4 @@ EXPOSE 8501
|
|
| 28 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 29 |
|
| 30 |
# Run the application
|
| 31 |
-
CMD ["sh", "-c", "
|
|
|
|
| 1 |
# Use Python 3.13 slim image
|
| 2 |
FROM python:3.13-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
|
|
|
| 11 |
# Install uv
|
| 12 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
| 13 |
|
| 14 |
+
# Set up a new user named "user" with user ID 1000 (required by HF Spaces)
|
| 15 |
+
RUN useradd -m -u 1000 user
|
| 16 |
+
|
| 17 |
+
# Switch to the "user" user
|
| 18 |
+
USER user
|
| 19 |
+
|
| 20 |
+
# Set home to the user's home directory
|
| 21 |
+
ENV HOME=/home/user \
|
| 22 |
+
PATH=/home/user/.local/bin:$PATH
|
| 23 |
+
|
| 24 |
+
# Set the working directory to the user's home directory
|
| 25 |
+
WORKDIR $HOME/app
|
| 26 |
+
|
| 27 |
+
# Copy project files with proper ownership
|
| 28 |
+
COPY --chown=user pyproject.toml uv.lock ./
|
| 29 |
+
COPY --chown=user src/ ./src/
|
| 30 |
|
| 31 |
# Install dependencies and the package
|
| 32 |
RUN uv sync --frozen && uv pip install -e .
|
|
|
|
| 38 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 39 |
|
| 40 |
# Run the application
|
| 41 |
+
CMD ["sh", "-c", "uv run streamlit run src/legisqa_local/app.py --server.port=${PORT:-8501} --server.address=0.0.0.0"]
|