Spaces:
Sleeping
Sleeping
Xiao commited on
Commit ·
c9a7d52
1
Parent(s): f846035
change nginx port
Browse files- .nginx/nginx.conf +8 -0
- Dockerfile +7 -1
- app.py +18 -11
- docker-compose.yaml +1 -0
- requirements.txt +4 -3
- run_hf.sh +6 -1
.nginx/nginx.conf
CHANGED
|
@@ -15,6 +15,14 @@ http {
|
|
| 15 |
# try_files $uri /index.html =404;
|
| 16 |
}
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
error_page 500 502 503 504 /50x.html;
|
| 19 |
|
| 20 |
# location /static/ {
|
|
|
|
| 15 |
# try_files $uri /index.html =404;
|
| 16 |
}
|
| 17 |
|
| 18 |
+
location /api {
|
| 19 |
+
# root /usr/share/nginx/html;
|
| 20 |
+
# root /app/public;
|
| 21 |
+
# index index.html index.htm;
|
| 22 |
+
proxy_pass http://localhost:8000;
|
| 23 |
+
# try_files $uri /index.html =404;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
error_page 500 502 503 504 /50x.html;
|
| 27 |
|
| 28 |
# location /static/ {
|
Dockerfile
CHANGED
|
@@ -36,6 +36,7 @@ RUN apk add --update nginx
|
|
| 36 |
|
| 37 |
|
| 38 |
|
|
|
|
| 39 |
#ubuntu
|
| 40 |
# Set up a new user named "luminlab" with user ID 1000
|
| 41 |
# RUN useradd -m -u 1000 luminlab
|
|
@@ -87,7 +88,6 @@ COPY --chown=luminlab .nginx/nginx.conf /etc/nginx/nginx.conf
|
|
| 87 |
# 1. For build React app
|
| 88 |
FROM lean AS dev
|
| 89 |
|
| 90 |
-
# Set working directory
|
| 91 |
|
| 92 |
#
|
| 93 |
COPY package.json /app/package.json
|
|
@@ -96,6 +96,9 @@ COPY package-lock.json /app/package-lock.json
|
|
| 96 |
COPY . /app
|
| 97 |
|
| 98 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Same as npm install
|
| 101 |
RUN npm ci
|
|
@@ -149,6 +152,9 @@ WORKDIR /app
|
|
| 149 |
COPY --chown=luminlab ./run_hf.sh /app/run_hf.sh
|
| 150 |
EXPOSE 3000
|
| 151 |
EXPOSE 5000
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
RUN chmod 777 /app/run_hf.sh
|
| 154 |
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
+
|
| 40 |
#ubuntu
|
| 41 |
# Set up a new user named "luminlab" with user ID 1000
|
| 42 |
# RUN useradd -m -u 1000 luminlab
|
|
|
|
| 88 |
# 1. For build React app
|
| 89 |
FROM lean AS dev
|
| 90 |
|
|
|
|
| 91 |
|
| 92 |
#
|
| 93 |
COPY package.json /app/package.json
|
|
|
|
| 96 |
COPY . /app
|
| 97 |
|
| 98 |
WORKDIR /app
|
| 99 |
+
# COPY --chown=luminlab requirements.txt /app/requirements.txt
|
| 100 |
+
|
| 101 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 102 |
|
| 103 |
# Same as npm install
|
| 104 |
RUN npm ci
|
|
|
|
| 152 |
COPY --chown=luminlab ./run_hf.sh /app/run_hf.sh
|
| 153 |
EXPOSE 3000
|
| 154 |
EXPOSE 5000
|
| 155 |
+
#flask
|
| 156 |
+
EXPOSE 8000
|
| 157 |
+
|
| 158 |
|
| 159 |
RUN chmod 777 /app/run_hf.sh
|
| 160 |
|
app.py
CHANGED
|
@@ -1,16 +1,23 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
|
| 3 |
|
| 4 |
-
def greet(name):
|
| 5 |
-
|
| 6 |
|
| 7 |
|
| 8 |
-
with gr.Blocks() as blocks:
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
blocks.queue()
|
| 16 |
-
blocks.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
|
| 3 |
|
| 4 |
+
# def greet(name):
|
| 5 |
+
# return "Hello " + name + "!"
|
| 6 |
|
| 7 |
|
| 8 |
+
# with gr.Blocks() as blocks:
|
| 9 |
+
# with gr.Row():
|
| 10 |
+
# text_in = gr.Text()
|
| 11 |
+
# text_out = gr.Text()
|
| 12 |
+
# btn = gr.Button("Run")
|
| 13 |
+
# btn.click(fn=greet, inputs=text_in, outputs=text_out)
|
| 14 |
|
| 15 |
+
# blocks.queue()
|
| 16 |
+
# blocks.launch()
|
| 17 |
+
from flask import Flask
|
| 18 |
+
app = Flask(__name__)
|
| 19 |
+
app.run(host='0.0.0.0', port=8000, debug=True)
|
| 20 |
+
|
| 21 |
+
@app.route('/')
|
| 22 |
+
def hello_world():
|
| 23 |
+
return 'Hello, World!'
|
docker-compose.yaml
CHANGED
|
@@ -12,6 +12,7 @@ services:
|
|
| 12 |
ports:
|
| 13 |
- "5000:5000"
|
| 14 |
- "3000:3000"
|
|
|
|
| 15 |
volumes:
|
| 16 |
- ./run_hf.sh:/app/run_hf.sh
|
| 17 |
- .nginx/nginx.conf:/etc/nginx/nginx.conf
|
|
|
|
| 12 |
ports:
|
| 13 |
- "5000:5000"
|
| 14 |
- "3000:3000"
|
| 15 |
+
# - "8000:8000"
|
| 16 |
volumes:
|
| 17 |
- ./run_hf.sh:/app/run_hf.sh
|
| 18 |
- .nginx/nginx.conf:/etc/nginx/nginx.conf
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
-
gradio==3.23.0
|
| 2 |
-
uvicorn
|
| 3 |
-
fastapi
|
|
|
|
|
|
| 1 |
+
# gradio==3.23.0
|
| 2 |
+
# uvicorn
|
| 3 |
+
# fastapi
|
| 4 |
+
flask
|
run_hf.sh
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
echo starting daemos
|
| 3 |
-
service nginx start
|
|
|
|
| 4 |
# nginx -g "daemon off;"
|
|
|
|
|
|
|
|
|
|
| 5 |
echo starting nmp
|
| 6 |
npm start
|
|
|
|
| 7 |
|
| 8 |
echo done!!!
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
echo starting daemos
|
| 3 |
+
# service nginx start
|
| 4 |
+
nginx &
|
| 5 |
# nginx -g "daemon off;"
|
| 6 |
+
echo starting flask
|
| 7 |
+
export FLASK_APP=/app/app.py
|
| 8 |
+
python -m flask run &
|
| 9 |
echo starting nmp
|
| 10 |
npm start
|
| 11 |
+
# npm run prod
|
| 12 |
|
| 13 |
echo done!!!
|