nexus3rd commited on
Commit
7e1eded
·
1 Parent(s): e85531a
Files changed (1) hide show
  1. Dockerfile +61 -58
Dockerfile CHANGED
@@ -1,63 +1,66 @@
1
  FROM python:3.9
2
 
3
- # Install dependencies and Node.js
4
- RUN apt-get update && apt-get install -y \
5
- curl \
6
- git \
7
- ssh \
8
- && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
9
- && apt-get install -y nodejs \
10
- && apt-get clean \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- WORKDIR /app
14
-
15
- # Configure SSH to recognize the host
16
- RUN mkdir -p /root/.ssh && ssh-keyscan hf.co >> /root/.ssh/known_hosts
17
-
18
- # Use the secret SSH key
19
- RUN --mount=type=secret,id=SSH_PRIVATE_KEY,mode=0444,required=true \
20
- echo "$(cat /run/secrets/SSH_PRIVATE_KEY)" > /root/.ssh/id_ed25519 && \
21
- chmod 600 /root/.ssh/id_ed25519
22
-
23
- # Install Node.js dependencies
24
- COPY package.json /app/package.json
25
- RUN npm install
26
-
27
- # Copy Tailwind configuration and static files
28
- COPY tailwind.config.js /app/tailwind.config.js
29
- COPY templates /app/templates
30
- COPY static /app/static
31
-
32
- # Run the Tailwind CSS build script
33
- RUN npm run publish
34
-
35
- # Git configuration
36
- RUN git config --global user.name "nexus3rd"
37
- RUN git config --global user.email "problemsolved1990@proton.me"
38
-
39
- # Clone the repository and conditionally commit and push changes
40
- RUN git clone git@hf.co:spaces/nexus4rd/ngrok /app/repo \
41
- && cp /app/templates/output.css /app/repo/templates/output.css \
42
- && cd /app/repo \
43
- && git add templates/output.css \
44
- && if ! git diff --cached --quiet; then \
45
- git commit -m "output.css" && git push -f; \
46
- else \
47
- echo "No changes to commit"; \
48
- fi
49
-
50
- # Create a user and set up the environment
51
- RUN useradd -m -u 1000 user
52
- USER user
53
- ENV PATH="/home/user/.local/bin:$PATH"
54
-
55
- # Copy and install Python dependencies
56
- COPY --chown=user ./requirements.txt requirements.txt
57
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
58
-
59
- # Copy the rest of the application code
60
- EXPOSE 7860
 
 
 
61
 
62
  # Run app.py when the container launches
63
  CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860", "--worker-class", "gevent"]
 
1
  FROM python:3.9
2
 
3
+ # Install dependencies and Node.js
4
+ RUN apt-get update && apt-get install -y \
5
+ curl \
6
+ git \
7
+ ssh \
8
+ && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
9
+ && apt-get install -y nodejs \
10
+ && apt-get clean \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ WORKDIR /app
14
+
15
+ # Configure SSH to recognize the host
16
+ RUN mkdir -p /root/.ssh && ssh-keyscan hf.co >> /root/.ssh/known_hosts
17
+
18
+ # Use the secret SSH key
19
+ RUN --mount=type=secret,id=SSH_PRIVATE_KEY,mode=0444,required=true \
20
+ echo "$(cat /run/secrets/SSH_PRIVATE_KEY)" > /root/.ssh/id_ed25519 && \
21
+ chmod 600 /root/.ssh/id_ed25519
22
+
23
+ # Install Node.js dependencies
24
+ COPY package.json /app/package.json
25
+ RUN npm install
26
+
27
+ # Copy Tailwind configuration and static files
28
+ COPY tailwind.config.js /app/tailwind.config.js
29
+ COPY templates /app/templates
30
+ COPY static /app/static
31
+
32
+ # Run the Tailwind CSS build script
33
+ RUN npm run publish
34
+
35
+ # Git configuration
36
+ RUN git config --global user.name "nexus3rd"
37
+ RUN git config --global user.email "problemsolved1990@proton.me"
38
+
39
+ # Clone the repository and conditionally commit and push changes
40
+ RUN git clone git@hf.co:spaces/nexus4rd/ngrok /app/repo \
41
+ && cp /app/templates/output.css /app/repo/templates/output.css \
42
+ && cd /app/repo \
43
+ && git add templates/output.css \
44
+ && if ! git diff --cached --quiet; then \
45
+ git commit -m "output.css" && git push -f; \
46
+ else \
47
+ echo "No changes to commit"; \
48
+ fi
49
+
50
+ # Create a user and set up the environment
51
+ RUN useradd -m -u 1000 user
52
+ USER user
53
+ ENV PATH="/home/user/.local/bin:$PATH"
54
+
55
+ # Copy and install Python dependencies
56
+ COPY --chown=user ./requirements.txt requirements.txt
57
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
58
+
59
+ # Copy the rest of the application code
60
+ # Ensure you copy your FastAPI application code here
61
+ COPY . .
62
+
63
+ EXPOSE 7860
64
 
65
  # Run app.py when the container launches
66
  CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860", "--worker-class", "gevent"]