Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +9 -7
Dockerfile
CHANGED
|
@@ -3,13 +3,19 @@
|
|
| 3 |
# 1. Base Image
|
| 4 |
FROM python:3.12-slim
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# 2. Set Environment Variables
|
| 7 |
# PYTHONDONTWRITEBYTECODE: Prevents Python from writing .pyc files to disc (equivalent to python -B)
|
| 8 |
# PYTHONUNBUFFERED: Prevents Python from buffering stdin/stdout/stderr (equivalent to python -u)
|
| 9 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 10 |
ENV PYTHONUNBUFFERED 1
|
| 11 |
-
ENV HF_HOME=/app/hf_home/
|
| 12 |
-
ENV UV_IGNORE_GIT_CACHE=1
|
| 13 |
|
| 14 |
# 3. Install system dependencies (git) and uv (Python package manager)
|
| 15 |
RUN apt-get update && \
|
|
@@ -20,16 +26,12 @@ RUN apt-get update && \
|
|
| 20 |
rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
# 4. Set working directory
|
| 23 |
-
WORKDIR /app
|
| 24 |
|
| 25 |
# 5. Clone the repository
|
| 26 |
# Cloning into the current directory (/app)
|
| 27 |
RUN git clone https://github.com/keshan/mcp_hackathon.git .
|
| 28 |
|
| 29 |
-
ENV UV_CACHE_DIR="/app/uv_cache"
|
| 30 |
-
|
| 31 |
-
RUN mkdir -p /app/uv_cache
|
| 32 |
-
|
| 33 |
# 6. Install Python dependencies using uv
|
| 34 |
# uv sync will read pyproject.toml and install dependencies.
|
| 35 |
# It will create and use a virtual environment in .venv by default.
|
|
|
|
| 3 |
# 1. Base Image
|
| 4 |
FROM python:3.12-slim
|
| 5 |
|
| 6 |
+
RUN useradd -m -u 1000 user
|
| 7 |
+
USER user
|
| 8 |
+
ENV HOME=/home/user
|
| 9 |
+
ENV UV_CACHE_DIR="$HOME/.cache/uv"
|
| 10 |
+
RUN mkdir -p "$UV_CACHE_DIR"
|
| 11 |
+
COPY --chown=user:user . .
|
| 12 |
+
|
| 13 |
# 2. Set Environment Variables
|
| 14 |
# PYTHONDONTWRITEBYTECODE: Prevents Python from writing .pyc files to disc (equivalent to python -B)
|
| 15 |
# PYTHONUNBUFFERED: Prevents Python from buffering stdin/stdout/stderr (equivalent to python -u)
|
| 16 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 17 |
ENV PYTHONUNBUFFERED 1
|
| 18 |
+
ENV HF_HOME=/home/user/app/hf_home/
|
|
|
|
| 19 |
|
| 20 |
# 3. Install system dependencies (git) and uv (Python package manager)
|
| 21 |
RUN apt-get update && \
|
|
|
|
| 26 |
rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
# 4. Set working directory
|
| 29 |
+
WORKDIR /home/user/app
|
| 30 |
|
| 31 |
# 5. Clone the repository
|
| 32 |
# Cloning into the current directory (/app)
|
| 33 |
RUN git clone https://github.com/keshan/mcp_hackathon.git .
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
# 6. Install Python dependencies using uv
|
| 36 |
# uv sync will read pyproject.toml and install dependencies.
|
| 37 |
# It will create and use a virtual environment in .venv by default.
|