Add static file serving and basic docker config
This commit is contained in:
parent
3fcb1fb8f5
commit
c10eca266a
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.env.development
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
FROM node:19.4-alpine AS frontend
|
||||
|
||||
ARG server_url
|
||||
RUN test -n "${server_url}"
|
||||
|
||||
COPY glebby-client /glebby-client
|
||||
WORKDIR /glebby-client
|
||||
RUN npm install
|
||||
ENV VITE_GLEBBY_SERVER_URL=${server_url}
|
||||
RUN npx vite build --outDir static
|
||||
|
||||
FROM python:3.11-alpine
|
||||
|
||||
COPY glebby-server /glebby-server
|
||||
WORKDIR /glebby-server
|
||||
RUN pip install -r requirements.txt
|
||||
RUN pip install gunicorn
|
||||
COPY --from=frontend /glebby-client/static /glebby-server/static
|
||||
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--threads", "100", "glebby:app"]
|
1
glebby-server/.gitignore
vendored
1
glebby-server/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
venv
|
||||
__pycache__
|
||||
static
|
||||
|
@ -152,9 +152,14 @@ class GlebbyState:
|
||||
state = GlebbyState()
|
||||
state.start_event_thread()
|
||||
|
||||
app = Flask(__name__)
|
||||
# TODO: Examine Quart (basically an asyncio version of flask)
|
||||
app = Flask(__name__, static_url_path='')
|
||||
sock = Sock(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return app.send_static_file('index.html')
|
||||
|
||||
@sock.route('/glebby')
|
||||
def echo(sock):
|
||||
client_id = state.add_client(sock)
|
||||
|
Loading…
x
Reference in New Issue
Block a user