Subham9126 commited on
Commit
6f1c4fd
·
verified ·
1 Parent(s): caf0551

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -19
Dockerfile CHANGED
@@ -1,32 +1,23 @@
1
- # Use the official AFFiNE stable image (Debian-based)
2
  FROM ghcr.io/toeverything/affine:stable
3
 
4
- # Hugging Face runs containers on port 7860
5
  ENV PORT=7860
6
  EXPOSE 7860
7
 
8
- # Switch to root to install Redis and fix permissions for Hugging Face
9
  USER root
10
-
11
- # Install Redis server for caching and queues
12
  RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/*
13
 
14
- # Create directories for AFFiNE data and grant ownership to the Hugging Face user (UID 1000)
15
- RUN mkdir -p /affine/config /affine/storage && \
16
- chown -R 1000:1000 /affine
17
 
18
- # Switch back to the Hugging Face user
19
  USER 1000
20
 
21
- # Tell AFFiNE to store config and uploads in our user-owned directory
22
- ENV CONFIG_LOCATION=/affine/config
23
- ENV UPLOAD_LOCATION=/affine/storage
24
-
25
- # Point AFFiNE to the local Redis instance we are about to start
26
  ENV REDIS_SERVER_HOST=localhost
27
- ENV REDIS_SERVER_PORT=6379
28
 
29
- # 1. Start Redis in the background (using /tmp so it has write access)
30
- # 2. Run AFFiNE's database migration script to prepare your Postgres DB
31
- # 3. Start the AFFiNE server
32
- CMD ["sh", "-c", "redis-server --daemonize yes --dir /tmp && node ./scripts/self-host-predeploy.js && node ./dist/index.js"]
 
 
1
  FROM ghcr.io/toeverything/affine:stable
2
 
3
+ # Port for Hugging Face
4
  ENV PORT=7860
5
  EXPOSE 7860
6
 
 
7
  USER root
8
+ # Install Redis
 
9
  RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Ensure the config directory exists and is writable by the HF user (1000)
12
+ RUN mkdir -p /home/node/.affine && chown -R 1000:1000 /home/node/.affine
 
13
 
 
14
  USER 1000
15
 
16
+ # AFFiNE Environment Variables
17
+ ENV NODE_ENV=production
18
+ ENV AFFINE_CONFIG_PATH=/home/node/.affine
 
 
19
  ENV REDIS_SERVER_HOST=localhost
 
20
 
21
+ # Fix: Use the correct entry point path for the stable image
22
+ # We start Redis, run the database setup, then launch the app via 'node ./dist/main.js'
23
+ CMD ["sh", "-c", "redis-server --daemonize yes --dir /tmp && node ./scripts/self-host-predeploy.js && node ./dist/main.js"]