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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -15
Dockerfile CHANGED
@@ -1,23 +1,32 @@
1
- # Use the official Wiki.js version 2 image
2
- FROM requarks/wiki:2
3
 
4
- # Switch to root to modify files during the build
5
- USER root
 
6
 
7
- # Wiki.js hardcodes port 3000 in its default config file.
8
- # We copy the sample config and use 'sed' to forcefully change it to 7860.
9
- RUN cp config.sample.yml config.yml && \
10
- sed -i 's/port: 3000/port: 7860/g' config.yml
11
 
12
- # Hugging Face Spaces strictly require the app to listen on port 7860
13
- EXPOSE 7860
14
 
15
- # Hugging Face Spaces execute containers as a non-root user (UID 1000).
16
- # Wiki.js needs write access to its own directory for logs and setup.
17
- RUN chown -R 1000:1000 /wiki
18
 
19
  # Switch back to the Hugging Face user
20
  USER 1000
21
 
22
- # Start the Wiki.js server
23
- CMD ["node", "server"]
 
 
 
 
 
 
 
 
 
 
 
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"]