Spaces:
Sleeping
Sleeping
File size: 1,055 Bytes
d0d9e2f c664b90 d0d9e2f 990e592 d0d9e2f 6e45580 6ca6257 d0d9e2f acd758f d0d9e2f 990e592 6e45580 19bdd67 d0d9e2f 990e592 d0d9e2f 19bdd67 d0d9e2f c664b90 d0d9e2f 6ca6257 d0d9e2f acd758f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# LocalAI Dockerfile for Hugging Face Spaces
FROM quay.io/go-skynet/local-ai:latest
# Create non-root user for security
RUN adduser --disabled-password --gecos "" --uid 1000 localai
# Create necessary directories
RUN mkdir -p /build/models /build/galleries /build/config /build/backends && \
chown -R localai:localai /build
# Set environment variables for Hugging Face Spaces
ENV PORT=7860
ENV ADDRESS=0.0.0.0:7860
ENV LOCALAI_ADDRESS=0.0.0.0:7860
ENV MODELS_PATH=/build/models
ENV GALLERIES_PATH=/build/galleries
ENV CONFIG_PATH=/build/config
ENV BACKENDS_PATH=/build/backends
# Performance optimizations
ENV THREADS=4
ENV CONTEXT_SIZE=2048
ENV REBUILD=false
ENV DEBUG=false
ENV SINGLE_ACTIVE_BACKEND=true
# Switch to non-root user
USER localai
WORKDIR /build
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:7860/readyz || exit 1
# Start LocalAI with explicit address
CMD ["local-ai", "--address", "0.0.0.0:7860"] |