Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -37
Dockerfile
CHANGED
|
@@ -1,46 +1,27 @@
|
|
| 1 |
FROM mintplexlabs/anythingllm:latest
|
| 2 |
|
| 3 |
-
# 1. Switch to root
|
| 4 |
-
# We will not switch back to user 1000. This bypasses all permission errors.
|
| 5 |
USER root
|
| 6 |
|
| 7 |
-
# 2.
|
| 8 |
-
RUN
|
| 9 |
-
|
| 10 |
-
echo "--- GLOBAL PERMISSION FIX ---"\n\
|
| 11 |
-
\n\
|
| 12 |
-
# A. Create the Persistent Storage Directory\n\
|
| 13 |
-
mkdir -p /data/storage\n\
|
| 14 |
-
\n\
|
| 15 |
-
# B. Create the "Hot Directory" for uploads\n\
|
| 16 |
-
mkdir -p /collector/hotdir\n\
|
| 17 |
-
\n\
|
| 18 |
-
# C. SYMLINK FIX (The ultimate fallback)\n\
|
| 19 |
-
# We delete the internal storage folder and link it to the persistent drive.\n\
|
| 20 |
-
# This ensures that ANY part of the app trying to write locally actually writes to /data.\n\
|
| 21 |
-
if [ ! -L "/app/server/storage" ]; then\n\
|
| 22 |
-
echo "Linking internal storage to persistent drive..."\n\
|
| 23 |
-
rm -rf /app/server/storage\n\
|
| 24 |
-
ln -s /data/storage /app/server/storage\n\
|
| 25 |
-
fi\n\
|
| 26 |
-
\n\
|
| 27 |
-
# D. Grant 777 permissions to everything (Just in case)\n\
|
| 28 |
-
chmod -R 777 /data\n\
|
| 29 |
-
chmod -R 777 /collector\n\
|
| 30 |
-
\n\
|
| 31 |
-
# E. Start the Application as ROOT\n\
|
| 32 |
-
echo "Starting AnythingLLM as ROOT..."\n\
|
| 33 |
-
export STORAGE_DIR="/data/storage"\n\
|
| 34 |
-
export DATABASE_URL="file:/data/storage/anythingllm.db"\n\
|
| 35 |
-
\n\
|
| 36 |
-
# Execute the original entrypoint command\n\
|
| 37 |
-
exec /usr/local/bin/docker-entrypoint.sh composer start\n\
|
| 38 |
-
' > /start.sh && chmod +x /start.sh
|
| 39 |
|
| 40 |
-
# 3.
|
| 41 |
ENV SERVER_PORT=7860
|
| 42 |
ENV STORAGE_DIR="/data/storage"
|
| 43 |
ENV DATABASE_URL="file:/data/storage/anythingllm.db"
|
| 44 |
|
| 45 |
-
# 4.
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM mintplexlabs/anythingllm:latest
|
| 2 |
|
| 3 |
+
# 1. Switch to root for full control
|
|
|
|
| 4 |
USER root
|
| 5 |
|
| 6 |
+
# 2. Pre-create directories just to be safe (permissions fixed at runtime below)
|
| 7 |
+
RUN mkdir -p /data/storage /collector/hotdir && \
|
| 8 |
+
chmod -R 777 /data /collector
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# 3. Set Environment Variables
|
| 11 |
ENV SERVER_PORT=7860
|
| 12 |
ENV STORAGE_DIR="/data/storage"
|
| 13 |
ENV DATABASE_URL="file:/data/storage/anythingllm.db"
|
| 14 |
|
| 15 |
+
# 4. Expose the port
|
| 16 |
+
EXPOSE 7860
|
| 17 |
+
|
| 18 |
+
# 5. THE FIX: Override ENTRYPOINT to use bash directly
|
| 19 |
+
# This tells Docker: "Don't look for a script file. Just run this bash command."
|
| 20 |
+
ENTRYPOINT ["/bin/bash", "-c"]
|
| 21 |
+
|
| 22 |
+
# 6. The Startup Command (Chained together)
|
| 23 |
+
# - Create/Fix folders on the persistent drive
|
| 24 |
+
# - Force permissions (777)
|
| 25 |
+
# - Link the internal storage folder to the persistent drive (Symlink)
|
| 26 |
+
# - Start the app
|
| 27 |
+
CMD ["mkdir -p /data/storage /collector/hotdir && chmod -R 777 /data /collector && rm -rf /app/server/storage && ln -s /data/storage /app/server/storage && echo 'Permissions fixed. Starting App...' && exec /usr/local/bin/docker-entrypoint.sh composer start"]
|