Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use the official Node.js image
FROM node:14

# Set working directory
WORKDIR /usr/src/app

# Copy package files and install dependencies
COPY package*.json ./
RUN npm install

# Copy the rest of the app
COPY . .

# Expose the port React runs on
EXPOSE 3001

# Start the React app
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "cross-env PORT=3001 react-scripts start",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
2 changes: 1 addition & 1 deletion src/apiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Contains all functions for api requests to the server.
*/
// const baseURL = 'http://localhost:3005';
const baseURL = '/api'
const baseURL = 'http://localhost:3000'

// Creates a POST request.
export function buildPostPayload(data) {
Expand Down