Spaces:
Paused
Paused
FROM python:3.10 | |
# Install git as root | |
RUN apt-get update && apt-get install -y git | |
# Create a user with home directory | |
RUN useradd -m -u 1000 user | |
# Set environment variables | |
ENV HOME=/home/user | |
# Switch to non-root user | |
USER user | |
# Set working directory to /app | |
WORKDIR /app | |
# Use the GIT_REPO argument from Hugging Face Secrets | |
ARG GIT_REPO | |
ENV GIT_REPO=${GIT_REPO} | |
# Clone the repo into /app/fastn8n | |
RUN git clone ${GIT_REPO} /app/fastn8n | |
# Debug: list /app to confirm cloning | |
RUN ls -la /app | |
# Change working directory to the cloned repo | |
WORKDIR /app/fastn8n | |
# Create virtual environment inside the repository directory | |
RUN python -m venv shared_env | |
# Upgrade pip inside the virtual environment | |
RUN shared_env/bin/pip install --upgrade pip | |
# Install project dependencies inside the virtual environment | |
RUN shared_env/bin/pip install --no-cache-dir -r requirements.txt | |
# Expose the desired port | |
EXPOSE 7860 | |
# Run the application using Uvicorn from the virtual environment (entry point is main:app) | |
CMD ["shared_env/bin/python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |