nexus3rd commited on
Commit
772e6e8
·
1 Parent(s): 2dcc8b0
Files changed (4) hide show
  1. .gitignore +1 -0
  2. Dockerfile +23 -1
  3. tailwind.config.js +7 -0
  4. templates/index.html +18 -10
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ node_modules/
Dockerfile CHANGED
@@ -2,14 +2,36 @@
2
  # you will also find guides on how best to write your Dockerfile
3
  FROM python:3.9
4
 
 
 
 
 
 
 
 
 
 
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
 
 
9
  WORKDIR /app
10
 
 
11
  COPY --chown=user ./requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
 
14
  COPY --chown=user . /app
15
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
2
  # you will also find guides on how best to write your Dockerfile
3
  FROM python:3.9
4
 
5
+ # Install Node.js and npm
6
+ RUN apt-get update && apt-get install -y \
7
+ curl \
8
+ && curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \
9
+ && apt-get install -y nodejs \
10
+ && apt-get clean \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Create a user and set up the environment
14
  RUN useradd -m -u 1000 user
15
  USER user
16
  ENV PATH="/home/user/.local/bin:$PATH"
17
 
18
+ # Set the working directory
19
  WORKDIR /app
20
 
21
+ # Copy and install Python dependencies
22
  COPY --chown=user ./requirements.txt requirements.txt
23
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
24
 
25
+ # Copy the rest of the application code
26
  COPY --chown=user . /app
27
+
28
+ # Install Tailwind CSS and build the CSS
29
+ RUN npm install -D tailwindcss postcss autoprefixer \
30
+ && npx tailwindcss init -p \
31
+ && echo "module.exports = { content: ['./templates/**/*.html'], theme: { extend: {}, }, plugins: [], };" > tailwind.config.js \
32
+ && mkdir -p static/css \
33
+ && echo "@tailwind base; @tailwind components; @tailwind utilities;" > static/css/styles.css \
34
+ && npx tailwindcss -i ./static/css/styles.css -o ./static/css/output.css --minify
35
+
36
+ # Command to run the application
37
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
tailwind.config.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ content: ["./templates/**/*.html"],
3
+ theme: {
4
+ extend: {},
5
+ },
6
+ plugins: [],
7
+ }
templates/index.html CHANGED
@@ -1,15 +1,23 @@
1
  <!DOCTYPE html>
2
- <html>
3
  <head>
 
 
4
  <title>Ngrok Endpoints</title>
 
5
  </head>
6
- <body>
7
- <h1>Active TCP Endpoints</h1>
8
- <ul>
9
- {% for endpoint in endpoints %}
10
- <li>{{ endpoint }}</li>
11
- {% endfor %}
12
- </ul>
 
 
 
 
 
 
13
  </body>
14
- </html>
15
- ``` **File: .gitignore**
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Ngrok Endpoints</title>
7
+ <link href="/static/css/output.css" rel="stylesheet">
8
  </head>
9
+ <body class="bg-gray-100">
10
+ <div class="container mx-auto p-6">
11
+ <h1 class="text-3xl font-bold mb-4">Active TCP Endpoints</h1>
12
+ <ul class="bg-white shadow-md rounded-lg">
13
+ {% if endpoints %}
14
+ {% for endpoint in endpoints %}
15
+ <li class="border-b p-4 hover:bg-gray-100">{{ endpoint }}</li>
16
+ {% endfor %}
17
+ {% else %}
18
+ <li class="p-4 text-gray-500">No active TCP endpoints found.</li>
19
+ {% endif %}
20
+ </ul>
21
+ </div>
22
  </body>
23
+ </html>