diff --git a/Dockerfile b/Dockerfile index 980584d1..72abb694 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,9 +45,8 @@ RUN pip install --no-cache-dir --prefix=/install \ FROM python:3.11-slim # Create non-root user for security -RUN groupadd -r voicebox && \ - useradd -r -g voicebox -m -s /bin/bash voicebox - +RUN groupadd -r -g 1000 voicebox && \ + useradd -r -g voicebox -u 1000 -m -s /bin/bash voicebox WORKDIR /app # Install only runtime system dependencies @@ -69,6 +68,10 @@ COPY --from=frontend --chown=voicebox:voicebox /build/web/dist /app/frontend/ RUN mkdir -p /app/data/generations /app/data/profiles /app/data/cache \ && chown -R voicebox:voicebox /app/data +# Create HuggingFace cache directory for the named volume +RUN mkdir -p /home/voicebox/.cache/huggingface \ + && chown -R voicebox:voicebox /home/voicebox/.cache/huggingface + # Switch to non-root user USER voicebox diff --git a/docker-compose.yml b/docker-compose.yml index f8ba9139..e7d6cb27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,15 @@ services: deploy: resources: + + # GPU passthrough + #reservations: + # devices: + # - driver: nvidia + # count: all + # capabilities: [gpu] + + # Resource limits limits: cpus: '4' memory: 8G