Kaballas commited on
Commit
64928c5
·
1 Parent(s): fce5139
Files changed (1) hide show
  1. Dockerfile +22 -19
Dockerfile CHANGED
@@ -1,28 +1,31 @@
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"]
 
1
  FROM doobidoo/mcp-memory-service:latest
2
 
3
+ # Create non-root user and required directories
4
+ RUN useradd -m -u 1000 user && \
5
+ mkdir -p /home/user/app/chroma_db /home/user/app/backups && \
6
+ chown -R user:user /home/user
7
+
8
+ # Switch to non-root user
9
+ USER user
10
  WORKDIR /home/user/app
11
 
12
+ # Set environment variables
13
+ ENV HOME=/home/user \
14
+ PATH=/home/user/.local/bin:$PATH \
15
+ PYTHONPATH=/home/user/app
16
 
17
+ # Copy application files
18
+ COPY --chown=user requirements.txt ./
19
+ RUN pip install --user --no-cache-dir -r requirements.txt
20
 
21
+ COPY --chown=user . .
 
 
22
 
23
+ # Expose port (documentation)
24
+ EXPOSE 7860
 
25
 
26
+ # Health check
27
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
28
+ CMD curl -f http://localhost:7860/health || exit 1
29
 
30
+ # Start application
31
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]