File size: 1,557 Bytes
7ea4fdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Start from the original repo
FROM ghcr.io/danny-avila/librechat-dev:latest

# Install dependencies
USER root
RUN apk update && apk add --no-cache \
    caddy \
    python3 \
    py3-pip \
    py3-dotenv \
    git && \
    pip install flask pymongo[srv] --break-system-packages

# Copy configuration files
COPY config.yaml /app/librechat.yaml
COPY Caddyfile /app/caddy/Caddyfile
COPY start-temp.sh /app/start.sh
RUN chmod +x /app/start.sh

# Create directory structure
RUN mkdir -p \
    /app/sudo/{templates,static} \
    /app/uploads/temp \
    /app/client/public/images/temp \
    /app/api/logs \
    /app/data \
    /app/caddy && \
    chmod -R 777 \
        /app/uploads/temp \
        /app/client/public/images \
        /app/api/logs \
        /app/data

# Copy application files
COPY index-temp.html /app/sudo/templates/index.html
COPY app-temp.py /app/sudo/app.py

# Set environment variables (use HF-specific vars where possible)
ENV HOST=0.0.0.0 \
    PORT=7860 \
    SESSION_EXPIRY=900000 \
    REFRESH_TOKEN_EXPIRY=604800000 \
    SEARCH=true \
    MEILI_NO_ANALYTICS=true \
    MEILI_HOST=https://martynka-meilisearch.hf.space \
    CONFIG_PATH=/app/librechat.yaml \
    CUSTOM_FOOTER=EasierIT \
    NODE_ENV=production

# Install additional dependencies
RUN cd /app/api && npm install

# Expose the correct port for HF Spaces
EXPOSE 7860

# Health check (recommended for HF Spaces)
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860 || exit 1

# Start command
CMD ["/app/start.sh"]