Update Dockerfile
Browse files- Dockerfile +24 -15
Dockerfile
CHANGED
|
@@ -1,23 +1,32 @@
|
|
| 1 |
-
# Use the official
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
RUN cp config.sample.yml config.yml && \
|
| 10 |
-
sed -i 's/port: 3000/port: 7860/g' config.yml
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
# Switch back to the Hugging Face user
|
| 20 |
USER 1000
|
| 21 |
|
| 22 |
-
#
|
| 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"]
|