# Pull the base image FROM ghcr.io/danny-avila/librechat-dev:latest EXPOSE 3080 # Set environment variables ENV HOST=0.0.0.0 ENV PORT=3080 ENV SESSION_EXPIRY=900000 ENV REFRESH_TOKEN_EXPIRY=604800000 ENV SEARCH=true ENV MEILI_NO_ANALYTICS=true ENV MEILI_HOST=https://wasabidrop-meilisearch.hf.space ENV MEILI_HTTP_ADDR=https://wasabidrop-meilisearch.hf.space # Create necessary directories (likely done as root by default initially) RUN mkdir -p /app/uploads/temp \ && mkdir -p /app/client/public/images/temp \ && mkdir -p /app/api/logs/ \ && mkdir -p /app/data # Give write permission to the directory # Note: 777 is very permissive, consider chown to the node user later if needed RUN chmod -R 777 /app/uploads/temp \ && chmod -R 777 /app/client/public/images \ && chmod -R 777 /app/api/logs/ \ && chmod -R 777 /app/data # Switch to root user to install packages USER root # Install curl using apk RUN apk update && apk add --no-cache curl # Copy Custom Endpoints Config (as root, writing to /app) RUN curl -o /app/librechat.yaml https://raw.githubusercontent.com/fuegovic/lc-config-yaml/main/librechat-rw.yaml # COPY librechat.yaml /app/librechat.yaml # Uncomment this and comment out the previous line to use the local librechat.yaml # Switch back to the non-root user (likely 'node' in this image) # This user should own the application files and run the process USER node # Install dependencies (as the 'node' user) # Assuming WORKDIR is already /app in the base image RUN cd /app/api && npm install # Command to run on container start (will run as 'node' user) CMD ["npm", "run", "backend"]