sam-fritz commited on
Commit
b4974f1
·
verified ·
1 Parent(s): e6a7869

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -10
Dockerfile CHANGED
@@ -1,22 +1,29 @@
1
  FROM mintplexlabs/anythingllm:latest
2
 
3
- # 1. Switch to root and STAY root.
4
  USER root
5
 
6
- # 2. Set Environment Variables
 
 
 
 
 
 
7
  ENV SERVER_PORT=7860
8
  ENV STORAGE_DIR="/data/storage"
9
  ENV DATABASE_URL="file:/data/storage/anythingllm.db"
10
 
11
- # 3. Expose the port
12
  EXPOSE 7860
13
 
14
- # 4. ENTRYPOINT: Use bash to run our custom logic
 
15
  ENTRYPOINT ["/bin/bash", "-c"]
16
 
17
- # 5. CMD: The Surgical Fix
18
- # - mkdir -p: Creates the subfolders (Safe)
19
- # - chmod 777: Apply ONLY to the subfolders (/data/storage), NOT the root (/data)
20
- # - Symlink: Redirects internal storage to persistent storage
21
- # - Start: Runs the app
22
- CMD ["mkdir -p /data/storage /collector/hotdir && chmod -R 777 /data/storage /collector/hotdir && 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"]
 
1
  FROM mintplexlabs/anythingllm:latest
2
 
3
+ # 1. Switch to root for the build phase
4
  USER root
5
 
6
+ # 2. BUILD TIME ACTION: Create the collector directory NOW.
7
+ # We do this here because we have full root access to the image filesystem during build.
8
+ # We also open the permissions immediately.
9
+ RUN mkdir -p /collector/hotdir && \
10
+ chmod -R 777 /collector
11
+
12
+ # 3. Set Environment Variables
13
  ENV SERVER_PORT=7860
14
  ENV STORAGE_DIR="/data/storage"
15
  ENV DATABASE_URL="file:/data/storage/anythingllm.db"
16
 
17
+ # 4. Expose the port
18
  EXPOSE 7860
19
 
20
+ # 5. RUNTIME ACTION: The Entrypoint Override
21
+ # We use /bin/bash to run our setup script every time the container starts.
22
  ENTRYPOINT ["/bin/bash", "-c"]
23
 
24
+ # 6. The Command Sequence
25
+ # A. mkdir -p /data/storage: Create the folder on the persistent drive.
26
+ # B. chmod -R 777 /data/storage: Ensure the persistent folder is writable.
27
+ # C. rm -rf ... && ln -s ...: Link the app's internal storage to the persistent drive.
28
+ # D. exec ...: Start the actual application.
29
+ CMD ["mkdir -p /data/storage && chmod -R 777 /data/storage && rm -rf /app/server/storage && ln -s /data/storage /app/server/storage && echo 'Starting AnythingLLM...' && exec /usr/local/bin/docker-entrypoint.sh composer start"]