FROM python:3.9-slim WORKDIR /code # Create logs directory with proper permissions RUN mkdir -p /code/logs && chmod 777 /code/logs # Copy application files COPY ./requirements.txt /code/requirements.txt COPY ./api.py /code/api.py COPY ./json_parser.py /code/json_parser.py COPY ./logger_config.py /code/logger_config.py COPY ./response_formatter.py /code/response_formatter.py COPY ./dify_client_python /code/dify_client_python # Install dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Install dify_client_python in editable mode WORKDIR /code/dify_client_python RUN pip install -e . # Return to main working directory WORKDIR /code # Ensure proper permissions for the entire code directory RUN chown -R 1000:1000 /code EXPOSE 7860 CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]