Spaces:
Running
Running
# 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"] |