Kaballas commited on
Commit
fce5139
·
1 Parent(s): 99f9882
Files changed (1) hide show
  1. Dockerfile +20 -29
Dockerfile CHANGED
@@ -1,37 +1,28 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
- FROM python:3.9
5
-
6
- RUN useradd -m -u 1000 user
7
- USER user
8
- ENV PATH="/home/user/.local/bin:$PATH"
9
-
10
-
11
- # Pull the latest image
12
  FROM doobidoo/mcp-memory-service:latest
13
 
 
 
 
 
 
 
14
 
15
- # Create storage directory and link
16
- RUN mkdir -p /data/storage && \
17
- ln -s /data/storage /storage
18
-
19
- RUN chown -R mcp:mcp /data/storage
20
-
21
-
22
- # Set environment variables for storage and server port
23
- ENV STORAGE_DIR="/data/storage"
24
- ENV SERVER_PORT=7860
25
- ENV LOG_LEVEL=debug
26
- # Switch back to the mcp user
27
- USER mcp
28
 
29
- # Set the entry point to run the script and the main application
30
- ENTRYPOINT ["/bin/bash","/usr/local/bin/render-entrypoint.sh"]
 
31
 
 
 
 
32
 
33
- WORKDIR /app
 
 
34
 
 
35
 
36
- COPY --chown=user . /app
37
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM doobidoo/mcp-memory-service:latest
2
 
3
+ # Create non-root user with UID 1000 (required for Spaces runtime)
4
+ USER root
5
+ RUN useradd -m -u 1000 user
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
+ WORKDIR /home/user/app
9
 
10
+ # Install nginx for reverse proxy (7860 external → 8000 internal)
11
+ RUN apt-get update && apt-get install -y --no-install-recommends nginx ca-certificates curl && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ # Remove default nginx site config and add our own
14
+ RUN rm -f /etc/nginx/sites-enabled/default
15
+ COPY --chown=user nginx.conf /etc/nginx/nginx.conf
16
 
17
+ # Prepare app directories
18
+ RUN mkdir -p /home/user/app/chroma_db /home/user/app/backups \
19
+ && chown -R 1000:1000 /home/user
20
 
21
+ # Add runtime entrypoint script
22
+ COPY --chown=user entrypoint.sh /home/user/app/entrypoint.sh
23
+ RUN chmod +x /home/user/app/entrypoint.sh
24
 
25
+ USER user
26
 
27
+ # Start both the service (on :8000) and nginx proxy (on :7860)
28
+ CMD ["/home/user/app/entrypoint.sh"]