Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +31 -15
Dockerfile
CHANGED
|
@@ -1,32 +1,48 @@
|
|
| 1 |
FROM mintplexlabs/anythingllm:latest
|
| 2 |
|
| 3 |
-
# Switch to root to
|
| 4 |
USER root
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
chmod -R 777 /data && \
|
| 9 |
-
chown -R 1000:1000 /data
|
| 10 |
-
|
| 11 |
-
# 2. FIX: Create the missing 'hotdir' directory explicitly
|
| 12 |
-
# The error shows the app looks for '/collector/hotdir', so we ensure it exists
|
| 13 |
-
# and is writable by the app user.
|
| 14 |
RUN mkdir -p /collector/hotdir && \
|
| 15 |
chmod -R 777 /collector && \
|
| 16 |
chown -R 1000:1000 /collector
|
| 17 |
|
| 18 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
ENV SERVER_PORT=7860
|
| 20 |
ENV STORAGE_DIR="/data/storage"
|
| 21 |
-
# Ensure the database is saved to the persistent drive
|
| 22 |
ENV DATABASE_URL="file:/data/storage/anythingllm.db"
|
| 23 |
|
| 24 |
-
# Expose port
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
# Switch back to the application user
|
| 28 |
USER 1000
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
CMD ["/usr/local/bin/docker-entrypoint.sh", "composer", "start"]
|
|
|
|
| 1 |
FROM mintplexlabs/anythingllm:latest
|
| 2 |
|
| 3 |
+
# Switch to root to configure the startup script
|
| 4 |
USER root
|
| 5 |
|
| 6 |
+
# Setup the Hotdir (Ephemeral processing folder)
|
| 7 |
+
# We do this at build time because this lives in the container, not the persistent drive.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN mkdir -p /collector/hotdir && \
|
| 9 |
chmod -R 777 /collector && \
|
| 10 |
chown -R 1000:1000 /collector
|
| 11 |
|
| 12 |
+
# Create a custom startup script
|
| 13 |
+
# This script runs at BOOT, so it can see the persistent drive.
|
| 14 |
+
RUN echo '#!/bin/bash\n\
|
| 15 |
+
\n\
|
| 16 |
+
# 1. Ensure the persistent storage directory exists on the mounted drive\n\
|
| 17 |
+
if [ ! -d "/data/storage" ]; then\n\
|
| 18 |
+
echo "Creating persistent storage directory..."\n\
|
| 19 |
+
mkdir -p /data/storage\n\
|
| 20 |
+
fi\n\
|
| 21 |
+
\n\
|
| 22 |
+
# 2. Fix permissions on the persistent drive so the app user can write to it\n\
|
| 23 |
+
echo "Fixing permissions..."\n\
|
| 24 |
+
chown -R 1000:1000 /data\n\
|
| 25 |
+
chmod -R 777 /data\n\
|
| 26 |
+
\n\
|
| 27 |
+
# 3. Export critical variables to force the app to use this path\n\
|
| 28 |
+
export STORAGE_DIR="/data/storage"\n\
|
| 29 |
+
export DATABASE_URL="file:/data/storage/anythingllm.db"\n\
|
| 30 |
+
\n\
|
| 31 |
+
# 4. Start the main application\n\
|
| 32 |
+
echo "Starting AnythingLLM..."\n\
|
| 33 |
+
exec /usr/local/bin/docker-entrypoint.sh composer start\n\
|
| 34 |
+
' > /start.sh && chmod +x /start.sh
|
| 35 |
+
|
| 36 |
+
# Set environment variables for the image as well (redundancy is good)
|
| 37 |
ENV SERVER_PORT=7860
|
| 38 |
ENV STORAGE_DIR="/data/storage"
|
|
|
|
| 39 |
ENV DATABASE_URL="file:/data/storage/anythingllm.db"
|
| 40 |
|
| 41 |
+
# Expose the port
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
# Switch back to the application user
|
| 45 |
USER 1000
|
| 46 |
|
| 47 |
+
# Use our custom script as the entrypoint command
|
| 48 |
+
CMD ["/start.sh"]
|
|
|