sam-fritz commited on
Commit
4fca57d
·
verified ·
1 Parent(s): 2994735

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -17
Dockerfile CHANGED
@@ -1,30 +1,32 @@
1
  FROM mintplexlabs/anythingllm:latest
2
 
3
- # 1. Switch to root for build-time operations
4
  USER root
5
 
6
- # 2. BUILD TIME: Create the collector directory and open permissions
 
7
  RUN mkdir -p /collector/hotdir && \
8
  chmod -R 777 /collector
9
 
10
- # 3. Environment Variables
11
- ENV SERVER_PORT=7860
12
- ENV STORAGE_DIR="/data/storage"
13
- ENV DATABASE_URL="file:/data/storage/anythingllm.db"
14
 
15
- # FIX: Add a secret key for user sessions (Required for login/auth to work)
16
- # You can change "my-super-secret-jwt-key" to any random string you want.
17
- ENV JWT_SECRET="n0CGf5vAfq3pF4udl25BYCmp903QEo"
 
18
 
19
- # 4. Expose the port
20
  EXPOSE 7860
21
 
22
- # 5. Runtime Entrypoint
23
  ENTRYPOINT ["/bin/bash", "-c"]
24
 
25
- # 6. Runtime Command
26
- # - Creates persistent folders
27
- # - Sets permissions on persistent folders
28
- # - Links internal storage to persistent storage
29
- # - Starts the app
30
- 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"]
 
 
1
  FROM mintplexlabs/anythingllm:latest
2
 
3
+ # 1. Switch to root to handle permissions and folder creation
4
  USER root
5
 
6
+ # 2. BUILD TIME: Create the "hot directory" for uploads
7
+ # We do this now so the folder definitely exists with open permissions.
8
  RUN mkdir -p /collector/hotdir && \
9
  chmod -R 777 /collector
10
 
11
+ # 3. CRITICAL FIX: Add the JWT Secret
12
+ # The app needs this to sign login tokens. Without it, uploads often fail.
13
+ ENV JWT_SECRET="my-random-secret-key-123"
 
14
 
15
+ # 4. ENVIRONMENT: Revert to Defaults!
16
+ # We do NOT set DATABASE_URL or STORAGE_DIR here.
17
+ # We let the app use its default internal paths, which we will redirect below.
18
+ ENV SERVER_PORT=7860
19
 
20
+ # 5. Expose the port
21
  EXPOSE 7860
22
 
23
+ # 6. ENTRYPOINT: Use bash to run our custom setup
24
  ENTRYPOINT ["/bin/bash", "-c"]
25
 
26
+ # 7. STARTUP COMMAND: The "Magic Link" Strategy
27
+ # - mkdir -p /data/storage: Create the physical folder on the hard drive.
28
+ # - chmod 777: Make it writable.
29
+ # - rm -rf /app/server/storage: Delete the app's internal "fake" storage.
30
+ # - ln -s ...: Replace it with a link to the hard drive.
31
+ # - start: Run the app.
32
+ CMD ["mkdir -p /data/storage && chmod -R 777 /data/storage && rm -rf /app/server/storage && ln -s /data/storage /app/server/storage && echo 'Storage linked. Starting App...' && exec /usr/local/bin/docker-entrypoint.sh composer start"]