|
1 | 1 | # SwiftComp-API |
| 2 | +[](https://github.com/wenbinyu/swiftcomp-api/releases) |
| 3 | +[](https://github.com/wenbinyugroup/swiftcomp-api/actions) |
| 4 | +[](https://codecov.io/gh/wenbinyugroup/swiftcomp-api) |
| 5 | +[](https://github.com/wenbinyugroup/swiftcomp-api/commits/main) |
| 6 | + |
2 | 7 |
|
3 | 8 | **SwiftComp-API** is a FastAPI-based backend designed to perform calculations related to composite laminate materials. It exposes various endpoints for computing engineering constants, plate properties, 3D laminate properties, and more. This API is suitable for researchers, engineers, and developers working in composite materials and structural analysis. |
4 | 9 |
|
|
34 | 39 |
|
35 | 40 | --- |
36 | 41 |
|
37 | | -## Installation |
| 42 | +## Installation Using Docker (recommend) |
| 43 | + |
| 44 | +### Prerequisites |
| 45 | +- Docker |
| 46 | + |
| 47 | +### Step-by-Step Guide |
| 48 | + |
| 49 | +1. **Clone the repository**: |
| 50 | +```bash |
| 51 | +git clone https://github.com/wenbinyugroup/swiftcomp-api.git |
| 52 | +cd swiftcomp-api |
| 53 | +``` |
| 54 | +2. **Building the Docker Image**: |
| 55 | +You can build a Docker image for the FastAPI app using the following command: |
| 56 | + |
| 57 | +```bash |
| 58 | +docker build -t swiftcomp-api . |
| 59 | +``` |
| 60 | +3. **Running the Docker Container**: |
| 61 | +Once the image is built, you can run the application in a Docker container: |
| 62 | + |
| 63 | +```bash |
| 64 | +docker run -d -p 8000:8000 swiftcomp-api |
| 65 | +``` |
| 66 | +This will run the SwiftComp API app in a container and map port 8000 from the container to your local machine. You can access the application at http://localhost:8000. |
| 67 | + |
| 68 | +4. **Running Tests Inside the Docker Container**: |
| 69 | +To run the tests inside the running Docker container: |
| 70 | + |
| 71 | +```bash |
| 72 | +docker exec $(docker ps -q -f ancestor=swiftcomp-api) bash -c "PYTHONPATH=./ pytest" |
| 73 | +``` |
| 74 | +This command sets the `PYTHONPATH` and runs `pytest` inside the running Docker container. |
| 75 | + |
| 76 | +5. **Monitoring Logs**: |
| 77 | +To monitor the logs from the running Docker container in real time: |
| 78 | + |
| 79 | +```bash |
| 80 | +docker logs -f <container_id_or_name> |
| 81 | +``` |
| 82 | +You can get the container ID or name by running: |
| 83 | + |
| 84 | +```bash |
| 85 | +docker ps |
| 86 | +``` |
| 87 | + |
| 88 | +## Installation Locally |
38 | 89 |
|
39 | 90 | To set up the project locally, follow these steps: |
40 | 91 |
|
|
0 commit comments