55 lines
2.1 KiB
Markdown
55 lines
2.1 KiB
Markdown
# Calculator
|
|
|
|
A simple, scientific calculator that runs in your browser.
|
|
|
|
## Dependencies
|
|
|
|
This project can be run in a few different ways, and dependencies vary based on the method you choose.
|
|
|
|
- **Browser Only**: No dependencies, but the calculator will not be served from a webserver.
|
|
- **Python**: To serve the `index.html` file, you'll need Python installed.
|
|
- **Docker**: To run the project in a container, you'll need Docker installed.
|
|
|
|
## How to Run
|
|
|
|
### Windows
|
|
|
|
- **With Python**: Run `start-server.bat`. This will start a Python web server and open the calculator in your default browser.
|
|
- **With Docker**: Run `run-docker.bat`. This will use Docker Compose to build and run the container.
|
|
|
|
### Linux / macOS
|
|
|
|
- **With Python**: Run `./start-server.sh`. You may need to make it executable first with `chmod +x start-server.sh`. This will start a Python web server and open the calculator in your default browser.
|
|
- **With Docker**: Run `./run-docker.sh`. You may need to make it executable first with `chmod +x run-docker.sh`. This will use Docker Compose to build and run the container.
|
|
|
|
## Server Setup
|
|
|
|
To deploy the calculator on a server, you only need Docker and Docker Compose installed. You do not need to clone this repository.
|
|
|
|
1. **Install Docker and Docker Compose**: Follow the official installation instructions for your server's operating system.
|
|
|
|
2. **Create a `compose.yaml` file**: On your server, create a new file named `compose.yaml` and add the following content:
|
|
|
|
```yaml
|
|
services:
|
|
web:
|
|
image: gitea.easye.me/ejones/jack-calc:latest
|
|
ports:
|
|
- 8888:80
|
|
restart: unless-stopped
|
|
```
|
|
|
|
3. **Start the container**: In the same directory where you created the `compose.yaml` file, run the following command:
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
The `-d` flag runs the container in detached mode. The `restart: unless-stopped` policy ensures that the container will automatically restart if the server is rebooted.
|
|
|
|
The calculator will then be available at `http://<your-server-ip>:8888`.
|
|
|
|
**Note on Firewalls**: Ensure that your server's firewall is configured to allow incoming traffic on port 8888.
|
|
|
|
---
|