Spaces:
Running
Running
Change to uv
Browse files- Dockerfile +11 -21
Dockerfile
CHANGED
|
@@ -1,28 +1,18 @@
|
|
| 1 |
-
FROM python:3.
|
|
|
|
| 2 |
|
| 3 |
# Set up a new user named "user" with user ID 1000
|
| 4 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
USER user
|
| 8 |
-
|
| 9 |
-
# Set home to the user's home directory
|
| 10 |
-
ENV HOME=/home/user \
|
| 11 |
-
PATH=/home/user/.local/bin:$PATH
|
| 12 |
-
|
| 13 |
-
# Set the working directory to the user's home directory
|
| 14 |
-
WORKDIR $HOME/app
|
| 15 |
-
|
| 16 |
-
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
| 17 |
-
RUN pip install --no-cache-dir --upgrade pip
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
COPY --chown=user
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
COPY --chown=user app.py app.py
|
| 27 |
|
| 28 |
-
|
|
|
|
| 1 |
+
FROM python:3.12
|
| 2 |
+
COPY --from=ghcr.io/astral-sh/uv:0.4.20 /uv /bin/uv
|
| 3 |
|
| 4 |
# Set up a new user named "user" with user ID 1000
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
ENV UV_SYSTEM_PYTHON=1
|
| 8 |
|
| 9 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 12 |
+
RUN uv pip install -r requirements.txt
|
| 13 |
|
| 14 |
+
COPY --chown=user . /app
|
| 15 |
+
# Switch to the "user" user
|
| 16 |
+
USER user
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
CMD ["solara", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|