From 7f16daf7f019de9738e03460a0024a6426c71c2f Mon Sep 17 00:00:00 2001 From: Daniel Busch Date: Sat, 2 Nov 2024 13:13:48 -0700 Subject: [PATCH 1/2] initial commit --- Dockerfile | 18 ++++++++++++++++++ app.py | 2 +- evora/debug.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b2190a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Use the official Python image +FROM python:3.10-slim + +# Set working directory +WORKDIR /usr/src/app + +# Copy and install dependencies +COPY . . +RUN pip install . + +# Set environment variables if needed +# ENV FLASK_ENV=development + +# Expose the port Flask runs on +EXPOSE 3000 + +# Start the Flask app +CMD ["python", "app.py"] diff --git a/app.py b/app.py index 844c892..fdc4e36 100644 --- a/app.py +++ b/app.py @@ -504,4 +504,4 @@ def OnExitApp(): # app.run(host='127.0.0.1', port=8000, debug=False, threaded=True, processes=1) # FOR DEBUGGING, USE: - app.run(host='127.0.0.1', port=3000, debug=True, processes=1, threaded=True) + app.run(host='0.0.0.0', port=3000, debug=True, processes=1, threaded=True) diff --git a/evora/debug.py b/evora/debug.py index b388684..b7f52d2 100644 --- a/evora/debug.py +++ b/evora/debug.py @@ -1 +1 @@ -DEBUGGING = False +DEBUGGING = True From 71ab5d575a726bf0e8cad55decc395de8933393e Mon Sep 17 00:00:00 2001 From: Daniel Busch Date: Sat, 2 Nov 2024 13:30:45 -0700 Subject: [PATCH 2/2] add readme --- DOCKER_README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 DOCKER_README.md diff --git a/DOCKER_README.md b/DOCKER_README.md new file mode 100644 index 0000000..eeed71e --- /dev/null +++ b/DOCKER_README.md @@ -0,0 +1,52 @@ +# How to use Docker for this + +You will need the following structure: + +```bash +root/ +├─ evora-server/ +├─ evora-client/ +├─ docker-compose.yml +``` + +The `docker-compose.yml` is a new file that is attached below: + +```yaml +version: '3.8' + +services: + evora-server: + build: + context: ./evora-server + ports: + - "3000:3000" + volumes: + - ./evora-server:/usr/src/app + command: python app.py # Start the Flask app + environment: + - FLASK_RUN_HOST=0.0.0.0 # Bind to all interfaces for external access + - FLASK_ENV=development # Optional: Enables Flask debug mode for development + + evora-client: + build: + context: ./evora-client + ports: + - "3001:3001" + volumes: + - ./evora-client:/usr/src/app + - /usr/src/app/node_modules # Add this to map node_modules correctly + + command: npm start # Start the React app + environment: + - PORT=3001 # Set the port for the React app + depends_on: + - evora-server +``` + +When you have this structure, go to the root directory and use the following command in the console (install Docker first): +`docker compose up --build` +which will build the container and run it. Then you can access the web app at + +`http://127.0.0.1:3001`. + +Note: When you React or Flask files, you do NOT need to rebuild the container. It will be automatically updated without you having to restart anything. \ No newline at end of file