Spaces:
Running
Running
trevorpfiz
commited on
Commit
·
246c6a1
1
Parent(s):
0a2029b
Spaces: switch to user 1000, port 7860, Gradio metadata; uv cache in HOME; run python -m vlm_playground.app
Browse files- Dockerfile +20 -7
- README.md +6 -7
Dockerfile
CHANGED
@@ -1,25 +1,38 @@
|
|
1 |
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# Enable bytecode compilation and copy mode for mounted volumes
|
6 |
ENV UV_COMPILE_BYTECODE=1
|
7 |
ENV UV_LINK_MODE=copy
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
# Install dependencies from lockfile using cache/bind mounts
|
10 |
-
RUN --mount=type=cache,target
|
11 |
-
--mount=type=bind,source=uv.lock,target=uv.lock \
|
12 |
-
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
13 |
uv sync --locked --no-install-project --no-dev
|
14 |
|
15 |
# Then, add the rest of the project source code and install it
|
16 |
# Installing separately from its dependencies allows optimal layer caching
|
17 |
-
COPY . /app
|
18 |
-
RUN --mount=type=cache,target
|
19 |
uv sync --locked --no-dev
|
20 |
|
21 |
# Place executables in the environment at the front of the path
|
22 |
-
ENV PATH="/app/.venv/bin:$PATH"
|
23 |
|
24 |
# Reset entrypoint; don't invoke uv directly
|
25 |
ENTRYPOINT []
|
|
|
1 |
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
2 |
|
3 |
+
ARG USERNAME=user
|
4 |
+
ARG USER_UID=1000
|
5 |
+
ARG USER_GID=1000
|
6 |
+
|
7 |
+
RUN groupadd --gid ${USER_GID} ${USERNAME} \
|
8 |
+
&& useradd --uid ${USER_UID} --gid ${USER_GID} --create-home ${USERNAME}
|
9 |
+
|
10 |
+
ENV HOME=/home/${USERNAME}
|
11 |
+
WORKDIR ${HOME}/app
|
12 |
|
13 |
# Enable bytecode compilation and copy mode for mounted volumes
|
14 |
ENV UV_COMPILE_BYTECODE=1
|
15 |
ENV UV_LINK_MODE=copy
|
16 |
|
17 |
+
USER ${USERNAME}
|
18 |
+
|
19 |
+
# Writable UV cache for non-root user
|
20 |
+
ENV UV_CACHE_DIR=${HOME}/.cache/uv
|
21 |
+
|
22 |
# Install dependencies from lockfile using cache/bind mounts
|
23 |
+
RUN --mount=type=cache,target=${HOME}/.cache/uv \
|
24 |
+
--mount=type=bind,source=uv.lock,target=uv.lock,readonly \
|
25 |
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml,readonly \
|
26 |
uv sync --locked --no-install-project --no-dev
|
27 |
|
28 |
# Then, add the rest of the project source code and install it
|
29 |
# Installing separately from its dependencies allows optimal layer caching
|
30 |
+
COPY --chown=${USERNAME}:${USERNAME} . ${HOME}/app
|
31 |
+
RUN --mount=type=cache,target=${HOME}/.cache/uv \
|
32 |
uv sync --locked --no-dev
|
33 |
|
34 |
# Place executables in the environment at the front of the path
|
35 |
+
ENV PATH="${HOME}/app/.venv/bin:$PATH"
|
36 |
|
37 |
# Reset entrypoint; don't invoke uv directly
|
38 |
ENTRYPOINT []
|
README.md
CHANGED
@@ -4,16 +4,15 @@ emoji: 🚀
|
|
4 |
colorFrom: red
|
5 |
colorTo: red
|
6 |
sdk: docker
|
7 |
-
app_port:
|
8 |
tags:
|
9 |
-
-
|
10 |
pinned: false
|
11 |
-
short_description:
|
12 |
---
|
13 |
|
14 |
-
#
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
forums](https://discuss.streamlit.io).
|
|
|
4 |
colorFrom: red
|
5 |
colorTo: red
|
6 |
sdk: docker
|
7 |
+
app_port: 7860
|
8 |
tags:
|
9 |
+
- gradio
|
10 |
pinned: false
|
11 |
+
short_description: Gradio docker space
|
12 |
---
|
13 |
|
14 |
+
# VLM Playground (Gradio)
|
15 |
|
16 |
+
This Space runs a minimal Gradio app served on port 7860 via Docker.
|
17 |
|
18 |
+
Local dev: `./run.sh` (exposes `http://localhost:7860`).
|
|