Spaces:
Sleeping
Sleeping
Ashwin V. Mohanan
commited on
Commit
·
79f1c92
1
Parent(s):
4404f06
Add Dockerfile
Browse files- Dockerfile +70 -0
- README.md +4 -4
Dockerfile
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Base image with CUDA 12.6.3 and cuDNN
|
| 2 |
+
# FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu22.04
|
| 3 |
+
FROM ubuntu:noble
|
| 4 |
+
|
| 5 |
+
# Set environment variables
|
| 6 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
| 7 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 8 |
+
GRADIO_FLAGGING_MODE=never \
|
| 9 |
+
GRADIO_NUM_PORTS=1 \
|
| 10 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 11 |
+
GRADIO_THEME=huggingface \
|
| 12 |
+
GRADIO_CACHE_DIR=/home/appuser/.gradio_cache \
|
| 13 |
+
SYSTEM=spaces \
|
| 14 |
+
AM_I_IN_A_DOCKER_CONTAINER=Yes \
|
| 15 |
+
PYTHONPATH=/home/appuser/app \
|
| 16 |
+
HF_HOME=/home/appuser/.cache \
|
| 17 |
+
TORCH_HOME=/home/appuser/.cache \
|
| 18 |
+
TMP_DIR=/home/appuser/tmp \
|
| 19 |
+
TRANSFORMERS_CACHE=/home/appuser/.cache/transformers \
|
| 20 |
+
NVIDIA_VISIBLE_DEVICES=all \
|
| 21 |
+
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 22 |
+
|
| 23 |
+
# Install system dependencies and set Python 3.10 as default
|
| 24 |
+
RUN apt-get update && apt-get install --no-install-recommends -y \
|
| 25 |
+
build-essential \
|
| 26 |
+
git \
|
| 27 |
+
python3.10 \
|
| 28 |
+
python3.10-distutils \
|
| 29 |
+
python3-pip \
|
| 30 |
+
ffmpeg \
|
| 31 |
+
libsm6 \
|
| 32 |
+
libxext6 \
|
| 33 |
+
libgl1 \
|
| 34 |
+
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
|
| 35 |
+
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
|
| 36 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 37 |
+
|
| 38 |
+
# Install `uv`
|
| 39 |
+
RUN pip install --upgrade pip \
|
| 40 |
+
&& pip install uv
|
| 41 |
+
|
| 42 |
+
# Create a non-root user
|
| 43 |
+
RUN useradd -m -u 1000 appuser
|
| 44 |
+
|
| 45 |
+
# Set working directory
|
| 46 |
+
WORKDIR /home/appuser/app
|
| 47 |
+
|
| 48 |
+
# Copy dependency files and install dependencies
|
| 49 |
+
COPY --chown=appuser pyproject.toml uv.lock LICENSE README.md ./
|
| 50 |
+
RUN uv sync --frozen --no-cache \
|
| 51 |
+
&& chown -R appuser:appuser /home/appuser/app/.venv \
|
| 52 |
+
&& rm -rf /root/.cache /home/appuser/.cache
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# Copy application code
|
| 56 |
+
COPY --chown=appuser app app
|
| 57 |
+
COPY --chown=appuser .gradio_cache .gradio_cache
|
| 58 |
+
|
| 59 |
+
# Ensure non-root user has write access to cache and tmp directories
|
| 60 |
+
RUN mkdir -p /home/appuser/.cache/transformers /home/appuser/tmp /home/appuser/.cache \
|
| 61 |
+
&& chown -R appuser:appuser /home/appuser/.cache /home/appuser/tmp/ /home/appuser/app/
|
| 62 |
+
|
| 63 |
+
# Switch to non-root user
|
| 64 |
+
USER appuser
|
| 65 |
+
|
| 66 |
+
# Expose port for Gradio
|
| 67 |
+
EXPOSE 7860
|
| 68 |
+
|
| 69 |
+
# Command to run the application
|
| 70 |
+
CMD ["uv", "run", "app/main.py"]
|
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
---
|
| 2 |
title: Dawsonia Demo
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
-
license:
|
| 9 |
-
short_description: Dawsonia demo
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: Dawsonia Demo
|
| 3 |
+
emoji: �
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
license: Apache-2.0
|
| 9 |
+
short_description: Dawsonia demo app
|
| 10 |
+
header: mini
|
| 11 |
---
|
|
|
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|