Skip to content

Commit

Permalink
script to run + docker file updated
Browse files Browse the repository at this point in the history
  • Loading branch information
FadyCoding committed Jul 18, 2024
1 parent 57a17ae commit 39fa3ba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ RUN npm run build

# DebiAI Python debiaiServer (old backend dir)
FROM python:3.10.12-slim-bullseye
WORKDIR /debiaiServer
COPY debiaiServer/ .
RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY --from=build-stage /frontend/dist dist
WORKDIR /
COPY debiaiServer/ debiaiServer/
RUN pip install --trusted-host pypi.python.org -r debiaiServer/requirements.txt
COPY run.py .
COPY --from=build-stage /frontend/dist debiaiServer/dist
ENV FLASK_ENV production
CMD ["python", "websrv.py"]
CMD ["python", "run.py"]

11 changes: 9 additions & 2 deletions debiaiServer/websrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ def open_browser(port):

def start_server(port, reloader=True, is_dev=True):
# Run DebiAI init
print("================= DebiAI " + get_app_version() + " ====================")
print(
"================= DebiAI " + get_app_version() + " ====================",
flush=True,
)
init()
print("======================== RUN =======================")
print("======================== RUN =======================", flush=True)
print(
" DebiAI is available at "
+ colored("http://localhost:" + str(port), DEBUG_COLOR)
Expand All @@ -105,3 +108,7 @@ def start_server(port, reloader=True, is_dev=True):
else:
# Use waitress for production
serve(app, host="0.0.0.0", port=port)


if __name__ == "__main__":
start_server(port=3000, reloader=False, is_dev=True)
3 changes: 3 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from debiaiServer import websrv

websrv.start_server(port=3000, reloader=False, is_dev=False)

0 comments on commit 39fa3ba

Please sign in to comment.