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