File size: 1,114 Bytes
19ef158
0d812de
124fa79
 
 
53bb30d
19ef158
0d812de
53bb30d
19ef158
0d812de
124fa79
19ef158
0d812de
f88a6bd
 
0d812de
f88a6bd
 
 
 
 
 
 
 
 
0d812de
53bb30d
f88a6bd
 
 
 
 
 
 
53bb30d
f88a6bd
 
a606eb4
75f98be
 
 
f88a6bd
 
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
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"]